示例#1
0
    public void spawnNew(int objType)
    {
        pickupTypes temp = (pickupTypes)objType;

        spawnedObj.Add(Instantiate(toSpawn, spawnLocation, Quaternion.identity));
        spawnedObj[spawnedObj.Count - 1].GetComponent <PickupBehavior>().setType(temp);
    }
 public static void SetPickUpVal(pickupTypes type, int val)
 {
     if (type == pickupTypes.Fire)
     {
         _numberFirePU = val;
     }
     else
     {
         return;
     }
 }
    //Return number of pick-ups
    public static int GetPickUp(pickupTypes type)
    {
        if (type == pickupTypes.Fire)
        {
            return(_numberFirePU);
        }

        else
        {
            return(-1);
        }
    }
示例#4
0
    public float pickupValueOrMult = 1f; //!< value or multiplier for pickup to apply to player

    /*!
     * Instantiates member values and assigns pickup type (randomly)
     */
    void Start()
    {
        player = GameObject.FindWithTag("Player").GetComponent <Player>();
        if (randomType)
        {
            pickupType = (pickupTypes)Random.Range(1, 5);
        }
        if (randomVal)
        {
            pickupValueOrMult = Random.Range(minVal, maxVal);
        }
    }
 //Add/Remove pick-ups based on enuma and bool input
 public static void QuantPickUp(pickupTypes type, bool isAdding)
 {
     if (isAdding)
     {
         switch (type)
         {
         case pickupTypes.Fire:
             _numberFirePU += 1;
             break;
         }
     }
     else
     {
         switch (type)
         {
         case pickupTypes.Fire:
             if (_numberFirePU > 0)
             {
                 _numberFirePU -= 1;
             }
             break;
         }
     }
 }
 public void setType(pickupTypes objType)
 {
     thisItem = objType;
 }