Exemplo n.º 1
0
 public override void EndOfUse()
 {
     if (!endTriggered)
     {
         if (onPointReached != null)
         {
             if (destroyAtPreviousCell)
             {
                 onPointReached.Invoke(previousValidPosCell);
             }
             else
             {
                 onPointReached.Invoke(currentValidPosCell);
             }
         }
         liveProjectile.DestroyProjectile();
         endTriggered = true;
     }
 }
Exemplo n.º 2
0
 public virtual bool Use()
 {
     if (CanUse())
     {
         AmountStack--;
         OnUsed?.Invoke();
         return(true);
     }
     OnFailUsed?.Invoke();
     return(false);
 }
Exemplo n.º 3
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (_buidlingInstance.GetComponent <BuildingDragger>().PutDownCube())
     {
         OnUsed?.Invoke();
         Destroy(this.gameObject);
     }
     else
     {
         Destroy(_buidlingInstance);
     }
 }
Exemplo n.º 4
0
    public void Use()
    {
        if (!CanUse())
        {
            return;
        }

        _cooldown = 1 / _useSpeed;

        if (_hasAmmunition)
        {
            _currentAmmunition -= 1;

            if (_currentAmmunition == 0)
            {
                Reload();
            }
        }

        OnUsed?.Invoke();
    }
 public override bool Perform()
 {
     if (actorInteracting == null)
     {
         Debug.LogError("Actor not set");
         return(false);
     }
     celllocationToSpawn = GridManager.instance.grid.WorldToCell(actorInteracting.transform.position + GridManager.instance.GetFacingDirectionOffsetVector3(actorInteracting.Facing));
     Debug.Log("Drop performing here");
     if (onActionOver != null)
     {
         Debug.Log("onActionOver");
         onActionOver.Invoke(actorInteracting);
     }
     if (onActionOverOnCellPosition != null)
     {
         Debug.Log("onActionOverOnCellPosition");
         onActionOverOnCellPosition.Invoke(celllocationToSpawn);
     }
     return(true);
 }
    public override bool Perform()
    {
        if (!initialiseSprite)
        {
            if (onMoveUseActionBegin != null)
            {
                onMoveUseActionBegin.Invoke(actorUsingMove);
            }
            //Debug.Log("initialiseSprite");
            actorUsingMove.UpdateBasicWalkingSprite();
            actorUsingMove.frameLooper.timeBetweenFrames = animationSpeed;
            initialiseSprite = true;
        }
        else
        {
            if (!actorUsingMove.frameLooper.isRepeatingLoop)
            {
                actorUsingMove.frameLooper.UpdateAnimationFrame();
                return(true);
            }
            else
            {
                if (!isBeingUsed)
                {
                    CancelMoveUsage();
                }

                if (onMoveUseActionOver != null)
                {
                    //Debug.LogError("sasa");
                    onMoveUseActionOver.Invoke(actorUsingMove);
                }
                return(false);
            }
        }
        return(false);
    }
Exemplo n.º 7
0
        public ValueType Use()
        {
            OnUsed.Invoke(Value);

            return(Value);
        }
Exemplo n.º 8
0
 protected void TriggerOnUse()
 {
     OnUsed?.Invoke();
 }