Ejemplo n.º 1
0
 private void Angle()
 {
     if (this.motion == FlowerTank.MOTION.up)
     {
         if (this.CanRight)
         {
             this.motion = FlowerTank.MOTION.right;
         }
         else if (this.CanDown)
         {
             this.motion = FlowerTank.MOTION.down;
         }
         else
         {
             if (!this.CanLeft)
             {
                 return;
             }
             this.motion = FlowerTank.MOTION.left;
         }
     }
     else if (this.motion == FlowerTank.MOTION.right)
     {
         if (this.CanDown)
         {
             this.motion = FlowerTank.MOTION.down;
         }
         else if (this.CanLeft)
         {
             this.motion = FlowerTank.MOTION.left;
         }
         else
         {
             if (!this.CanUP)
             {
                 return;
             }
             this.motion = FlowerTank.MOTION.up;
         }
     }
     else if (this.motion == FlowerTank.MOTION.down)
     {
         if (this.CanLeft)
         {
             this.motion = FlowerTank.MOTION.left;
         }
         else if (this.CanUP)
         {
             this.motion = FlowerTank.MOTION.up;
         }
         else
         {
             if (!this.CanRight)
             {
                 return;
             }
             this.motion = FlowerTank.MOTION.right;
         }
     }
     else
     {
         if (this.motion != FlowerTank.MOTION.left)
         {
             return;
         }
         if (this.CanUP)
         {
             this.motion = FlowerTank.MOTION.up;
         }
         else if (this.CanRight)
         {
             this.motion = FlowerTank.MOTION.right;
         }
         else if (this.CanDown)
         {
             this.motion = FlowerTank.MOTION.down;
         }
     }
 }
Ejemplo n.º 2
0
        protected override void Moving()
        {
            this.neutlal = true;
            float speed = 1f;

            switch (this.version)
            {
            case 1:
                speed = 0.3f;
                break;

            case 2:
                speed = 0.5f;
                break;
            }
            int angle = 0;

            switch (this.motion)
            {
            case FlowerTank.MOTION.up:
                if (!this.CanUP && !this.slideInit)
                {
                    this.Angle();
                    break;
                }
                break;

            case FlowerTank.MOTION.down:
                if (!this.CanDown && !this.slideInit)
                {
                    this.Angle();
                    break;
                }
                break;

            case FlowerTank.MOTION.left:
                if (!this.CanLeft && !this.slideInit)
                {
                    this.Angle();
                    break;
                }
                break;

            case FlowerTank.MOTION.right:
                if (!this.CanRight && !this.slideInit)
                {
                    this.Angle();
                    break;
                }
                break;
            }
            switch (this.motion)
            {
            case FlowerTank.MOTION.up:
                angle = 2;
                break;

            case FlowerTank.MOTION.down:
                angle = 3;
                break;

            case FlowerTank.MOTION.left:
                angle = this.union == Panel.COLOR.blue ? 0 : 1;
                break;

            case FlowerTank.MOTION.right:
                angle = this.union == Panel.COLOR.blue ? 1 : 0;
                break;
            }
            if ((this.CanUP || this.CanDown || (this.CanLeft || this.CanRight)) && (this.parent.nowscene != SceneBattle.BATTLESCENE.end && !this.HeviSand) || this.slideInit)
            {
                if (this.SlideMove(speed, angle))
                {
                    this.SlideMoveEnd();
                    this.PositionDirectSet();
                    if ((this.CanUP || this.CanDown || (this.CanLeft || this.CanRight)) && this.parent.nowscene != SceneBattle.BATTLESCENE.end && !this.HeviSand)
                    {
                        bool flag = false;
                        if (this.version == 0)
                        {
                            this.motion = (FlowerTank.MOTION) this.Random.Next(4);
                        }
                        switch (this.motion)
                        {
                        case FlowerTank.MOTION.up:
                            if (!this.CanUP)
                            {
                                flag = true;
                                break;
                            }
                            break;

                        case FlowerTank.MOTION.down:
                            if (!this.CanDown)
                            {
                                flag = true;
                                break;
                            }
                            break;

                        case FlowerTank.MOTION.left:
                            if (!this.CanLeft)
                            {
                                flag = true;
                                break;
                            }
                            break;

                        case FlowerTank.MOTION.right:
                            if (!this.CanRight)
                            {
                                flag = true;
                                break;
                            }
                            break;
                        }
                        this.shot = false;
                        if (flag)
                        {
                            FlowerTank.MOTION motion = this.motion;
                            this.Angle();
                            if (motion == this.motion)
                            {
                            }
                        }
                        this.moveend = false;
                    }
                }
                else
                {
                    switch (this.motion)
                    {
                    case FlowerTank.MOTION.up:
                        if (this.moveflame)
                        {
                            if (this.frame >= 5)
                            {
                                this.frame = 0;
                            }
                            this.animationpoint.X = this.AnimeUP(this.frame).X;
                            break;
                        }
                        break;

                    case FlowerTank.MOTION.down:
                        if (this.moveflame)
                        {
                            if (this.frame >= 5)
                            {
                                this.frame = 0;
                            }
                            this.animationpoint.X = this.AnimeDown(this.frame).X;
                            break;
                        }
                        break;

                    case FlowerTank.MOTION.left:
                        if (this.moveflame)
                        {
                            if (this.frame >= 6)
                            {
                                this.frame = 0;
                            }
                            if (this.union == Panel.COLOR.blue)
                            {
                                this.animationpoint.X = this.AnimeLeft(this.frame).X;
                            }
                            else
                            {
                                this.animationpoint.X = this.AnimeRight(this.frame).X;
                            }
                            break;
                        }
                        break;

                    case FlowerTank.MOTION.right:
                        if (this.moveflame)
                        {
                            if (this.frame >= 6)
                            {
                                this.frame = 0;
                            }
                            if (this.union == Panel.COLOR.blue)
                            {
                                this.animationpoint.X = this.AnimeRight(this.frame).X;
                            }
                            else
                            {
                                this.animationpoint.X = this.AnimeLeft(this.frame).X;
                            }
                            break;
                        }
                        break;
                    }
                }
                switch (this.motionup)
                {
                case FlowerTank.MOTIONUP.neutral:
                    if (!this.shot || this.version == 0)
                    {
                        bool flag = false;
                        int  num  = 0;
                        foreach (CharacterBase characterBase in this.parent.AllChara())
                        {
                            if (characterBase.union == this.UnionEnemy && characterBase.position.Y == this.position.Y)
                            {
                                flag = true;
                                num  = characterBase.position.X;
                                break;
                            }
                        }
                        if (flag)
                        {
                            this.counterTiming = true;
                            this.shot          = true;
                            this.sound.PlaySE(SoundEffect.canon);
                            this.motionup = FlowerTank.MOTIONUP.attack;
                            this.parent.effects.Add(new Smoke(this.sound, this.parent, new Vector2(this.positionDirect.X + 30 * this.UnionRebirth, this.positionDirect.Y - 8f), this.position, ChipBase.ELEMENT.normal));
                            Point end = new Point(this.position.X + 3 * this.UnionRebirth, this.position.Y);
                            if (this.version == 0)
                            {
                                end = new Point(this.position.X + this.Random.Next(2, 4) * this.UnionRebirth, this.position.Y);
                            }
                            this.parent.attacks.Add(new CanonBomb(this.sound, this.parent, this.positionre.X, this.positionre.Y, this.union, this.Power, 1, new Vector2(this.positionDirect.X + 30 * this.UnionRebirth, this.positionDirect.Y - 9f), end, 40, CanonBomb.TYPE.single, false, CanonBomb.TYPE.single));
                            this.shot = true;
                        }
                        break;
                    }
                    break;

                case FlowerTank.MOTIONUP.attack:
                    if (this.moveflame)
                    {
                        ++this.animationpointUP.X;
                        if (this.animationpointUP.X >= 4)
                        {
                            this.counterTiming      = false;
                            this.animationpointUP.X = 0;
                            this.motionup           = FlowerTank.MOTIONUP.neutral;
                        }
                        break;
                    }
                    break;
                }
            }
            else
            {
                this.positionre = this.position;
                this.PositionDirectSet();
                this.Angle();
            }
            this.FlameControl();
            this.MoveAftar();
        }