Beispiel #1
0
 public void SetState(WitchState state)
 {
     m_states[m_witch.State].EndState();
     m_states[m_witch.State].enabled = false;
     m_witch.State = state;
     m_states[m_witch.State].enabled = true;
     m_states[m_witch.State].BeginState();
 }
Beispiel #2
0
 private void Awake()
 {
     m_stateSystem       = GetComponent <WitchStateSystem>();
     m_stateSystem.Witch = this;
     m_skillSystem       = GetComponent <WitchSkillSystem>();
     m_skillSystem.Witch = this;
     m_curState          = WitchState.Idle;
 }
Beispiel #3
0
    public void SetState(WitchState state)
    {
        if (_curState == state)
        {
            return;
        }

        _stateSystem.SetState(state);
    }
    public void SetState(WitchState state)
    {
        Witch.Anim.SetInteger("State", (int)state);

        _states[_witch.State].EndState();
        _states[_witch.State].enabled = false;
        _witch.State = state;
        _states[_witch.State].enabled = true;
        _states[_witch.State].BeginState();
    }
Beispiel #5
0
 protected override void Awake()
 {
     base.Awake();
     _stateSystem       = GetComponent <WitchStateSystem>();
     _stateSystem.Witch = this;
     _skillSystem       = GetComponent <WitchSkillSystem>();
     _skillSystem.Witch = this;
     _curState          = WitchState.Groggy;
     _player            = FindObjectOfType <CPlayerManager>();
     _receiveDamage     = 0.0f;
     _collider          = FindObjectOfType <WitchWeaponCollider>();
     //_footHoldSpawnTime = WitchValueManager.I.FootholdContinueTime;
     _spawner   = FindObjectOfType <WitchMonsterSpawnerObject>();
     _isGravity = true;
 }
Beispiel #6
0
	public void DealDamage(float damage) {
		if (state == WitchState.Melted)
			return;
		health -= damage;
		speed = 0;

		switch(state) {
		case WitchState.Idle:
			animator.SetBool ("Idle", false);
			break;
		case WitchState.Walking:
			animator.SetBool ("Walk", false);
			break;
		case WitchState.Lunging:
		case WitchState.Spellcasting:
			animator.SetBool ("DoWitchyAction", false);
			break;
		}

		if (health <= 0) {
			state = WitchState.Melted;
			AudioSource.PlayClipAtPoint (DeathSound, transform.localPosition);
			animator.SetBool ("Die", true);
		} else {
			if (!wasDamaged) {
				wasDamaged = true;
				AudioSource.PlayClipAtPoint (ScreamSound, transform.localPosition);
			}
			state = WitchState.Damaged;
			animator.SetBool("Hit", true);
		}


	}
Beispiel #7
0
 public void SetAnimation(WitchState state)
 {
     _anim.SetInteger("State", (int)state);
 }
Beispiel #8
0
        } // MoveToRight

        // *********************************************************************

        public float MoveToLeft()
        {
            moving = true;
            switch (state)
            {
            case WitchState.LeftWalk:
                if (X > All.MIDDLE_MAP)
                {
                    X -= 1;
                    return(0.0f);
                }
                if (!couldScroll)
                {
                    X -= 1;
                    return(0.0f);
                }
                // TODO: changer ça si on veut bloquer le scroll de la carte (sous terrain)
                // faire plutôt X+=1 et retourner 0.0f
                return(SPEED_SLOW);

            case WitchState.LeftMount:
                return(0);

            case WitchState.LeftDescend:
                return(0);

            case WitchState.LeftFlySlow:
                X += 3;
                if (X >= All.SPEED_RIGHT_MIDDLE)
                {
                    ChangeToState(WitchState.LeftFlyMiddle);
                    return(CalcSpeedRight());
                }
                return(0.0f);

            case WitchState.LeftFlyMiddle:
                X += 3;
                if (X >= All.SPEED_RIGHT_MAX)
                {
                    ChangeToState(WitchState.LeftFlyMax);
                }
                return(CalcSpeedRight());

            case WitchState.LeftFlyMax:
                return(CalcSpeedRight());

            case WitchState.RightWalk:     // demi-tour
                currentStep = toRight.StepAnim;
                toLeft.SetAnimSteps(currentStep, currentStep, 0);
                state = WitchState.LeftWalk;
                return(0);

            case WitchState.RightMount:
                return(0);

            case WitchState.RightDescend:
                return(0);

            case WitchState.RightFlySlow:
                X += 3;
                if (X > All.MIDDLE_MAP)
                {
                    ChangeToState(WitchState.LeftFlySlow);
                }
                return(0.0f);

            case WitchState.RightFlyMiddle:
                X += 3;
                if (X > All.SPEED_LEFT_MIDDLE)
                {
                    ChangeToState(WitchState.RightFlySlow);
                    return(0.0f);
                }
                return(-CalcSpeedLeft());

            case WitchState.RightFlyMax:
                X += 3;
                if (X > All.SPEED_LEFT_MAX)
                {
                    ChangeToState(WitchState.RightFlyMiddle);
                }
                return(-CalcSpeedLeft());

            case WitchState.EnterDoor:
                return(0);

            case WitchState.ExitingDoor:
                return(0);

            case WitchState.MakePotion:
                return(0);

            case WitchState.Dying:
                return(0);
            }
            return(0);
        } // MoveToLeft
Beispiel #9
0
        // *********************************************************************

        private void ChangeToState(WitchState newState)
        {
            if (state == WitchState.Dying)
            {
                return;
            }
            switch (newState)
            {
            case WitchState.LeftWalk:
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_WALK);
                break;

            case WitchState.LeftMount:
                toLeft.SetAnimSteps(3, 8, ANIM_DELAY_MOUNT, true);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_MOUNT);
                break;

            case WitchState.LeftDescend:
                toLeft.SetAnimSteps(8, 3, ANIM_DELAY_MOUNT, true);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_MOUNT);
                break;

            case WitchState.LeftFlySlow:
                toLeft.SetAnimSteps(8, 9, ANIM_DELAY_FLY_SLOW);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_FLY_SLOW);
                break;

            case WitchState.LeftFlyMiddle:
                toLeft.SetAnimSteps(14, 17, ANIM_DELAY_FLY_MIDDLE);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_FLY_MIDDLE);
                break;

            case WitchState.LeftFlyMax:
                toLeft.SetAnimSteps(10, 13, ANIM_DELAY_FLY_MAX);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_FLY_MAX);
                break;

            case WitchState.RightWalk:
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_WALK);
                break;

            case WitchState.RightMount:
                toRight.SetAnimSteps(3, 8, ANIM_DELAY_MOUNT, true);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_MOUNT);
                break;

            case WitchState.RightDescend:
                toRight.SetAnimSteps(8, 3, ANIM_DELAY_MOUNT, true);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_MOUNT);
                break;

            case WitchState.RightFlySlow:
                toRight.SetAnimSteps(8, 9, ANIM_DELAY_FLY_SLOW);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_FLY_SLOW);
                break;

            case WitchState.RightFlyMiddle:
                toRight.SetAnimSteps(14, 17, ANIM_DELAY_FLY_MIDDLE);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_FLY_MIDDLE);
                break;

            case WitchState.RightFlyMax:
                toRight.SetAnimSteps(10, 13, ANIM_DELAY_FLY_MAX);
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_FLY_MAX);
                break;

            case WitchState.MakePotion:
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_MAKE_POTION);
                break;

            case WitchState.Dying:
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_DYING);
                break;

            case WitchState.ExitingDoor:
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_DOOR_ENTER);
                break;

            case WitchState.EnterDoor:
                animElaps = TimeSpan.FromMilliseconds(ANIM_DELAY_DOOR_ENTER);
                break;
            }
            state     = newState;
            startAnim = DateTime.UtcNow;
            PrintState();
        }
Beispiel #10
0
        // *********************************************************************

        public void DoAlive()
        {
            couldScroll = true;
            state       = WitchState.MakePotion;
            PrintState();
        }
Beispiel #11
0
 public void SetState(WitchState state)
 {
     m_stateSystem.SetState(state);
 }
Beispiel #12
0
    public void UpdateAnimations(WitchState witch)
    {
        base.UpdateAnimations(witch);

        /* call on some WitchState functions... */
    }