示例#1
0
    private void ReadMovementSequenceFile()
    {
        string[] sequence = movementSequenceFile.text.Split(new string[] { Environment.NewLine, " " }, StringSplitOptions.None);
        for (int i = 0; i < sequence.Length; i++)
        {
            string word = sequence[i];
            float  x, y, t;
            switch (word)
            {
            case "SPAWN":
                EnemySpawnAction spawn = new EnemySpawnAction();

                x = float.Parse(sequence[++i]);
                y = float.Parse(sequence[++i]);
                spawn.spawnPosition = new Vector3(x, y, 0);

                movementSequence.Add(spawn);
                break;

            case "MOVE":
                EnemyMovementAction move = new EnemyMovementAction();

                x = float.Parse(sequence[++i]);
                y = float.Parse(sequence[++i]);
                move.targetPosition = new Vector3(x, y, 0);

                t = float.Parse(sequence[++i]);
                move.moveDuration = t;

                movementSequence.Add(move);
                break;

            case "IDLE":
                EnemyIdleAction idle = new EnemyIdleAction();

                t = float.Parse(sequence[++i]);
                idle.idleDuration = t;

                movementSequence.Add(idle);
                break;
            }
        }
    }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     CurrentAction = EnemyIdleAction.GetInstance();
 }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     Status.Hp        = 1000000000f;
     Status.CurrentHp = Status.Hp;
     CurrentAction    = EnemyIdleAction.GetInstance();
 }