コード例 #1
0
        private void startbattle(Uwudle ourUwudle, Uwudle target)
        {
            MovementStrategy ourOldStrat    = ourUwudle.Movement.Strategy;
            MovementStrategy targetOldStrat = target.Movement.Strategy;

            ourUwudle.Movement.Stop();
            target.Movement.Stop();
            ourUwudle.Movement.Strategy = MovementStrategy.Idle;
            target.Movement.Strategy    = MovementStrategy.Idle;
            teleportUwudle(ourUwudle, target);

            currentBattle = new Battle(ourUwudle, target);
            inBattle      = true;
            currentBattle.Start((Uwudle winner) => endBattle(winner, ourUwudle, target, ourOldStrat, targetOldStrat));
        }
コード例 #2
0
        public void endBattle(Uwudle winner, Uwudle ourUwudle, Uwudle target, MovementStrategy ourOldStrat, MovementStrategy targetOldStrat)
        {
            inBattle = false;
            ourUwudle.Movement.Strategy = ourOldStrat;
            target.Movement.Strategy    = targetOldStrat;
            ourUwudle.Movement.Move();
            target.Movement.Move();
            if (ourUwudle.Health.Hp == 0)
            {
                ourUwudle.PoofWoodle();
            }
            ourUwudle.Health.Hp = ourUwudle.Health.MaxHp;
            var wild = target.GetComponent <WildUwudle>();

            if (wild && target.Health.Hp == 0)
            {
                wild.Kill();
                ourUwudle.LevelUp();
            }
        }