public void ThrowGrenade()
    {
        ThrowData data = new ThrowData(this, Target, ActiveSkill, myGrenades[0]);

        myGrenades[0].Throw(data);
        OnThrowStart.Invoke(data);
        FinishedThrowingGrenade();
    }
Esempio n. 2
0
 public void switchFunc()
 {
     if (methodIdx == 4)
     {
         if (isTriggered)
         {
             isTriggered = false;
             Debug.Log("Throw!");
             onThrow.Invoke(curIdx);
         }
         else
         {
             isTriggered = true;
             Debug.Log("Grab!");
             onGrab.Invoke();
         }
     }
 }
 public void Update(float deltaTime)
 {
     if (currentThrow != null)
     {
         throwTime += deltaTime;
         Vector3 arc    = new Vector3(0, Mathf.Sin(throwTime * Mathf.PI), 0);
         Vector3 newPos = Vector3.Lerp(currentThrow.Source.Position, currentThrow.Target.Position, throwTime * speed);
         SetPosition(newPos + arc);
         if (Vector3.Distance(newPos, currentThrow.Target.Position) == 0)
         {
             currentThrow.Target.ReceiveGrenade(this); // TODO: This is probably bad... but whatever
             OnCaught.Invoke(currentThrow);
             currentThrow.Source.ActionCompleted();
             currentThrow = null;
             throwTime    = 0;
         }
     }
 }
 public void Throw(ThrowData data)
 {
     currentThrow = data;
     OnThrown.Invoke(data);
 }