Пример #1
0
    public Collectible GetHeldCollectible()
    {
        if (grabbedObject == null)
        {
            return(null);
        }
        if (grabbedObject.GetType().Equals(typeof(Collectible)) || grabbedObject.GetType().IsSubclassOf(typeof(Collectible)))
        {
            return((Collectible)grabbedObject);
        }

        return(null);
    }
Пример #2
0
    private void ConsumePowerSource()
    {
        if (grabbedObject == null)
        {
            state = States.None;
            return;
        }

        if (grabbedObject.GetType().Equals(typeof(ResourceCube)))
        {
            ((ResourceCube)grabbedObject).UseEnergy(energyUsePerSecond * Time.deltaTime);
        }
    }