コード例 #1
0
    protected virtual void AddBeerDrinkingAction()
    {
        KeyValuePair <NeedType, float>[] rewards = new KeyValuePair <NeedType, float> [2];
        rewards[0] = new KeyValuePair <NeedType, float>(NeedType.FUN, 30f);
        rewards[1] = new KeyValuePair <NeedType, float>(NeedType.BLADDER, -20f);

        TimedAction action = new TimedAction(
            beerBottle.GetComponent <AdvertisingObject>(),
            "Drinking beer",
            null,
            rewards,
            () => { // onend
            beerBottle.transform.parent = null;
            beerBottle.GetComponent <Rigidbody>().isKinematic = false;
            beerBottle.GetComponent <Collider>().enabled      = true;
            RubbishSpawner.AddRubbishToObject(beerBottle, 5f, 2f);
            interactable = true;
            GetComponent <AIMoveController>().drunkness += 0.4f;
            ikcontrol.DrinkItem(false);
            ikcontrol.GrabItem(false);
            GetComponent <UsePPSound>().Happy();
        },
            () => {
            GetComponent <UsePPSound>().PlayBeerBotteClinging();
            ikcontrol.DrinkItem(true);
        },       // on start
            5f); // dirnking duration

        GetComponent <ActionManager>().actionQueue.Enqueue(action);
    }
コード例 #2
0
    // TODO JOSCHA MACH HIER DEIN KOTZE NEI
    private void Puke()
    {
        // spawn a puddle, add a vfx

        // make puddle a rubbish, with value 50f
        GameObject random = Instantiate <GameObject>(pukePrefab, pukePosition.position, pukePosition.rotation);

        RubbishSpawner.AddRubbishToObject(random, 50.0f, 8.0f);
    }
コード例 #3
0
    IEnumerator KonfettiTimer()
    {
        int wait_time = Random.Range(10, 60);

        yield return(new WaitForSeconds(wait_time));

        GameObject konf = Instantiate(_konfettiPrefab, pukePosition.position, Quaternion.Euler(-90f, 0, 0));

        RubbishSpawner.AddRubbishToObject(konf, 4.0f, 2.5f);
    }
コード例 #4
0
 protected virtual void OnSliceEaten()
 {
     slicesLeft--;
     if (slicesLeft <= 0)
     {
         //Debug.Log("Pizza is now empty and turns to rubbish!");
         slices[0].SetActive(false);
         RubbishSpawner.AddRubbishToObject(gameObject, 20f);
         //Destroy(gameObject);
     }
     else
     {
         slices[(slicesLeft) % slices.Length].SetActive(false);
     }
 }
コード例 #5
0
 private void Start()
 {
     RubbishSpawner.AddRubbishToObject(gameObject, 3, 7f);
 }