Exemplo n.º 1
0
    public override void SetCombatHandler(CombatHandler ch)
    {
        base.SetCombatHandler(ch);

        _rigidBody = ch.GetComponent <Rigidbody> ();
        _rigidBody.maxAngularVelocity = 15f;
    }
Exemplo n.º 2
0
    public void Execute(CombatHandler handler, StateType statetype)
    {
        if (startClip != null)
        {
            handler.GetComponent <AudioSource>().clip = startClip;
            handler.GetComponent <AudioSource>().Play();
        }

        CombatInfo combatInfo = new CombatInfo(statetype, damage, applyVelocity, isKnockDown, stiffTime, isCrit, hitClip);

        if (combatType == CombatType.Attack)
        {
            handler.PrepareAttack(combatInfo);
        }
        else if (combatType == CombatType.Project)
        {
            Vector3 point = new Vector3(launchPoint.x, launchPoint.y, 0f);
            int     flip  = handler.transform.rotation.eulerAngles.y > 90f  ? -1 : 1;
            point.x *= flip;
            Projectile instance = Object.Instantiate(projectile, handler.transform.position + point, handler.transform.rotation).GetComponent <Projectile>();
            instance.ownerId    = handler.gameObject.name;
            instance.combatInfo = combatInfo;
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Unlock player controls that was locked
    /// </summary>
    /// <param name="seconds">Seconds.</param>
    protected virtual void unlockControls()
    {
        if (_combatHandler.GetComponent <PlayerMovementControl> () != null)
        {
            PlayerMovementControl pmc = _combatHandler.GetComponent <PlayerMovementControl> ();
//			if (!_isTurnAllowed)
            pmc.SetIsTurnAllowed(true);
//			if (!_isMovmentAllowed)
            pmc.SetIsMovementAllowed(true);
//			if (!_isSprintAllowed)
            pmc.SetIsSprintAllowed(true);
        }
//			if (_weapon.GetOwner ().GetComponent<PlayerMovementControl> () != null) {
//				PlayerMovementControl pmc = _weapon.GetOwner ().GetComponent<PlayerMovementControl> ();
//				if (!_isTurnAllowed)
//					pmc.SetIsTurnAllowed (true);
//				if (!_isMovmentAllowed)
//					pmc.SetIsMovementAllowed (true);
//				if (!_isSprintAllowed)
//					pmc.SetIsSprintAllowed (true);
//			}
    }
Exemplo n.º 4
0
 public override void SetCombatHandler(CombatHandler ch)
 {
     base.SetCombatHandler(ch);
     _rigidbody = ch.GetComponent <Rigidbody> ();
 }