c#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class PillarMove : MonoBehaviour { 6 7 public enum MoveType 8 { 9 Light, 10 Left, 11 Before, 12 After 13 } 14 public MoveType moveType; 15 public Transform Mytransform; 16 public Vector3 DefaltPosition; 17 public float MoveTimer; 18 public float MoveTime; 19 20 // Update is called once per frame 21 void Update () { 22 MoveTimer++; 23 transform.position = DefaltPosition; 24 if(MoveTimer > MoveTime) 25 { 26 MoveSwitch(); 27 MoveTimer = 0; 28 } 29 } 30 private void MoveSwitch() 31 { 32 switch (moveType) 33 { 34 case MoveType.Before: 35 //DefaltPosition.z++; 36 DefaltPosition.z = transform.position.z + 1; 37 break; 38 case MoveType.After: 39 //DefaltPosition.z--; 40 DefaltPosition.z = transform.position.z - 1; 41 42 break; 43 case MoveType.Left: 44 //DefaltPosition.x++; 45 DefaltPosition.x = transform.position.x + 1; 46 47 break; 48 case MoveType.Light: 49 // DefaltPosition.x--; 50 DefaltPosition.x = transform.position.x - 1; 51 52 break; 53 } 54 } 55} 56
以上のようにスクリプト、設定をしていたのですが、
実行時に元居た座標から変更されてしまっているのですがどうしてなんでしょうか・・・?
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。