Beispiel #1
0
    // Use this for initialization
    void Awake()
    {
        currentHealth = maxHealth;
        coolDown      = 0f;
        currentAmmo   = maxAmmo - maxClip;
        currentClip   = maxClip;

        anim = GetComponent <Animator> ();

        if (secondary.tag == "Tripwire")
        {
            secondaryAttack = new TripwireAttack(secondary);
        }
        else if (secondary.tag == "GasGrenade")
        {
            secondaryAttack = new GasAttack(secondary);
        }
        else if (secondary.tag == "Sword")
        {
            secondaryAttack = new SwordAttack(secondary);
        }
        else if (secondary.tag == "Artillery")
        {
            secondaryAttack = new ArtilleryAttack(secondary);
        }
        else
        {
            //secondaryAttack = new SecondaryAttack ();
            print("NO SECONDARY");
        }
    }
 /// <summary>
 ///     Handles a change in PlayerKeyState.
 /// </summary>
 /// <param name="sender">Sender of the event.</param>
 /// <param name="e">Object containing information about the event.</param>
 public void Handle(object sender, KeyStateChangedEventArgs e)
 {
     if (Action != null && _check(e, Keys.Action))
     {
         Action.Handle(sender, e);
     }
     if (Crouch != null && _check(e, Keys.Crouch))
     {
         Crouch.Handle(sender, e);
     }
     if (Fire != null && _check(e, Keys.Fire))
     {
         Fire.Handle(sender, e);
     }
     if (Sprint != null && _check(e, Keys.Sprint))
     {
         Sprint.Handle(sender, e);
     }
     if (SecondaryAttack != null && _check(e, Keys.SecondaryAttack))
     {
         SecondaryAttack.Handle(sender, e);
     }
     if (Jump != null && _check(e, Keys.Jump))
     {
         Jump.Handle(sender, e);
     }
     if (LookRight != null && _check(e, Keys.LookRight))
     {
         LookRight.Handle(sender, e);
     }
     if (Handbrake != null && _check(e, Keys.Handbrake))
     {
         Handbrake.Handle(sender, e);
     }
     if (Aim != null && _check(e, Keys.Aim))
     {
         Aim.Handle(sender, e);
     }
     if (LookLeft != null && _check(e, Keys.LookLeft))
     {
         LookLeft.Handle(sender, e);
     }
     if (Submission != null && _check(e, Keys.Submission))
     {
         Submission.Handle(sender, e);
     }
     if (Walk != null && _check(e, Keys.Walk))
     {
         Walk.Handle(sender, e);
     }
     if (AnalogUp != null && _check(e, Keys.AnalogUp))
     {
         AnalogUp.Handle(sender, e);
     }
     if (AnalogDown != null && _check(e, Keys.AnalogDown))
     {
         AnalogDown.Handle(sender, e);
     }
     if (AnalogLeft != null && _check(e, Keys.AnalogLeft))
     {
         AnalogLeft.Handle(sender, e);
     }
     if (AnalogRight != null && _check(e, Keys.AnalogRight))
     {
         AnalogRight.Handle(sender, e);
     }
     if (Yes != null && _check(e, Keys.Yes))
     {
         Yes.Handle(sender, e);
     }
     if (No != null && _check(e, Keys.No))
     {
         No.Handle(sender, e);
     }
     if (CtrlBack != null && _check(e, Keys.CtrlBack))
     {
         CtrlBack.Handle(sender, e);
     }
 }