コード例 #1
0
ファイル: Zombie.cs プロジェクト: Cristian41/Zombie4
            // Se le otorga toda la información necesaria al zombie
            void Start()
            {
                if (!enemigoss)
                {
                    edad = (int)Random.Range(15, 101);
                    informacionZombie = new InformaciondelZombie();
                    color             = Random.Range(0, 3);
                    Rigidbody Zom;
                    Zom                  = this.gameObject.AddComponent <Rigidbody>();
                    Zom.constraints      = RigidbodyConstraints.FreezeAll;
                    Zom.useGravity       = false;
                    this.gameObject.name = "Zombie";
                }
                else
                {
                    edad = informacionZombie.edad;
                    this.gameObject.name = informacionZombie.nombre;
                }
                StartCoroutine(buscaAldeanos());
                velocidadseguir     = 10 / edad;
                this.gameObject.tag = "Zombie";
                Sabor Sabor;

                Sabor = (Sabor)Random.Range(0, 5);
                gusto = Sabor.ToString();
                informacionZombie.gusto = gusto;
                if (color == 0)
                {
                    this.gameObject.GetComponent <Renderer>().material.color = UnityEngine.Color.cyan;
                }
                if (color == 1)
                {
                    this.gameObject.GetComponent <Renderer>().material.color = UnityEngine.Color.magenta;
                }
                if (color == 2)
                {
                    this.gameObject.GetComponent <Renderer>().material.color = UnityEngine.Color.green;
                }
            }
コード例 #2
0
 public new string SaborEscolhido() => Sabor.ToString();