Exemplo n.º 1
0
        public void Update()
        {
            if (player.hasWaterBall())
            {
                StateWait.ChangeState(player);
                return;
            }

            if (targetWaterBall == null)
            {
                StateWait.ChangeState(player);
                return;
            }

            if (targetWaterBall.GetComponent <WaterBall>().Parent != null)
            {
                StateWait.ChangeState(player);
                return;
            }

            if (player.Agent.enabled && player.isReached())
            {
                StateWait.ChangeState(player);
                return;
            }
        }
Exemplo n.º 2
0
        private IEnumerator useWater()
        {
            yield return(new WaitForSeconds(0.5f));

            if (targetCell != null)
            {
                if (player.hasWaterBall())
                {
                    var cellScript = targetCell.GetComponent <Field.Cell>();
                    cellScript.GiveWater(player.WaterBall.GetComponent <WaterBall>());
                    UnityEngine.Object.Destroy(player.WaterBall);
                    player.WaterBall = null;
                }
                targetCell = null;

                yield return(new WaitForSeconds(0.5f));

                StateWait.ChangeState(player);
                yield break;
            }
            else
            {
                StateWait.ChangeState(player);
                yield break;
            }
        }
Exemplo n.º 3
0
        private IEnumerator Attack()
        {
            while (true)
            {
                yield return(new WaitForSeconds(0.5f));

                if (targetObstacle != null)
                {
                    targetObstacle.GetComponent <Obstacle.Obj>().Damage(1);

                    yield return(new WaitForSeconds(0.5f));

                    if (targetObstacle == null)
                    {
                        StateWait.ChangeState(player);
                        yield break;
                    }
                }
                else
                {
                    // 何らかの理由で目標の Obstacle がなくなったらWaitへ
                    StateWait.ChangeState(player);
                    yield break;
                }
            }
        }
Exemplo n.º 4
0
        void Start()
        {
            WaterBall = null;
            Agent     = GetComponent <NavMeshAgent>();
            Anim      = GetComponent <Animator>();
            Signal    = Signal.None;
            state     = null;

            StartCoroutine(UpdateLife());

            StateWait.ChangeState(this);
        }
Exemplo n.º 5
0
        public void Update()
        {
            // 何らかの理由で目標の Obstacle がなくなった
            if (targetObstacle == null)
            {
                StateWait.ChangeState(player);
                return;
            }

            // 到着
            if (player.Agent.enabled && player.isReached())
            {
                StateAttack.ChangeState(player, targetObstacle);
                return;
            }
        }