コード例 #1
0
ファイル: Creature.cs プロジェクト: Buya-Games/MimicA-GOAP
    //you can eat anything, but gives you different nourishment
    public void Eat(Spawner.EnvironmentType type)
    {
        float eatBenefit = 0;

        if (type == Spawner.EnvironmentType.Berry)
        {
            eatBenefit = 50;
            manager.particles.EatingBerry(HeldItem.transform.position);
        }
        if (type == Spawner.EnvironmentType.Fungus)
        {
            eatBenefit = 25;
            manager.particles.EatingFungus(HeldItem.transform.position);
        }
        if (type == Spawner.EnvironmentType.BerryPoop || type == Spawner.EnvironmentType.FungusPoop)
        {
            eatBenefit = 10;
            manager.particles.BombExplosion(HeldItem.transform.position);
        }
        health = Mathf.Clamp(health + eatBenefit, 10, 100);
        HeldItem.GetComponent <Item>().Drop();//not using DropItem cuz it causes a conflict.... it's a turd i know i need to clean it up
        manager.spawner.DespawnEnvironment(HeldItem, type);
        HeldItem = null;
        manager.ui.DisplayMessage(transform.position, "+" + eatBenefit.ToString("F0"), Color.white);
        manager.audioManager.PlaySound("eat", 0, 1, Random.Range(.9f, 1.1f));
    }
コード例 #2
0
 void SetType()
 {
     if (gameObject.layer == 6)
     {
         MyType = Spawner.EnvironmentType.Bush;
     }
     if (gameObject.layer == 8)
     {
         MyType = Spawner.EnvironmentType.Mushroom;
     }
 }
コード例 #3
0
ファイル: Item.cs プロジェクト: Buya-Games/MimicA-GOAP
 void SetType()
 {
     if (gameObject.layer == 7)
     {
         MyType = Spawner.EnvironmentType.Berry;
     }
     if (gameObject.layer == 9)
     {
         MyType = Spawner.EnvironmentType.Fungus;
     }
     if (gameObject.layer == 10)
     {
         MyType = Spawner.EnvironmentType.BerryPoop;
     }
     if (gameObject.layer == 16)
     {
         MyType = Spawner.EnvironmentType.FungusPoop;
     }
 }