Exemple #1
0
        public override void Updata()
        {
            if (this.parent.blackOut && this.frame < 2)
            {
                return;
            }
            this.animationpoint.X = this.frame;
            if (this.frame % 4 == 0)
            {
                switch (this.flinchState)
                {
                case FlinchState.PurpleScale:
                    this.flinchState = FlinchState.Outline;
                    break;

                case FlinchState.Outline:
                    this.flinchState = FlinchState.DoubleImage;
                    break;

                case FlinchState.DoubleImage:
                    this.flinchState = FlinchState.PurpleScale;
                    break;
                }
            }
            if (this.frame >= 40)
            {
                this.flag = false;
            }
            this.FlameControl();
            ++this.frame;
        }
 public void ResetState(ref PlayerState playerState)
 {
     playerState = PlayerState.Default;
     flinchState = FlinchState.Setup;
     timer       = 0f;
     spriteRenderer.material.SetFloat("_FlashAmount", 0f);
 }
 // Use this for initialization
 void Start()
 {
     timer = 0f;
     //knockBackDirection = Vector2.zero;
     flinchState    = FlinchState.Setup;
     spriteRenderer = GetComponent <SpriteRenderer> ();
     animator       = GetComponent <Animator> ();
     playerBody     = GetComponent <Rigidbody2D> ();
     hurtInfo       = GetComponent <HurtInfoReceiver> ();
 }
Exemple #4
0
        public DruidManFlinch(
            IAudioEngine audio,
            SceneBattle parent,
            Vector2 positionDirect,
            bool reverse,
            Point battlePosition)
            : base(audio, parent, battlePosition.X, battlePosition.Y)
        {
            this.picturename      = "druidman";
            this.posi             = positionDirect;
            this.animationpoint.Y = 2;
            this.rebirth          = reverse;

            this.flinchState = FlinchState.PurpleScale;
        }
    //Makes the player flinch (when player is hurt)
    public void Flinch(ref PlayerState playerState)
    {
        switch (flinchState)
        {
        case FlinchState.Setup:
            timer = flinchTime;
            playerBody.velocity = Vector2.zero;
            //Play Flinch Animation according to face direction

            //Set sprite color to red to indicate hurt
            spriteRenderer.material.SetFloat("_FlashAmount", 0.60f);

            //Add force to player in a direction
            playerBody.AddForce(hurtInfo.direction * hurtInfo.force);

            flinchState = FlinchState.Flinching;

            break;

        case FlinchState.Flinching:
            timer -= Time.deltaTime;

            //Gradually change red color to normal

            if (timer <= 0f)
            {
                timer = 0f;
                //Set sprite color to normal
                spriteRenderer.material.SetFloat("_FlashAmount", 0f);

                flinchState = FlinchState.Done;
            }
            break;

        case FlinchState.Done:
            flinchState = FlinchState.Setup;
            playerState = PlayerState.Default;
            //knockBackDirection = Vector2.zero;
            break;
        }
    }