Exemplo n.º 1
0
    IEnumerator damageColor(enemy e)
    {
        e.GetComponent <Renderer>().material = dmgMat;
        yield return(new WaitForSeconds(damageCd));

        e.GetComponent <Renderer>().material = eMat;
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        try
        {
            chouseEnemy.captionText.text = "Trent";
            chouseEnemy.options[0].text  = "Trent";
            chouseEnemy.options[1].text  = "Mole";
            chouseEnemy.options[2].text  = "Trent Heavy";
            hippoSpeed.text    = "5";
            winScore.text      = "10";
            rechargeTime.text  = "2";
            enemyRecharge.text = "4";
            DropdownItemSelected(chouseEnemy);
            chouseEnemy.onValueChanged.AddListener(delegate { DropdownItemSelected(chouseEnemy); });
        }
        catch (NullReferenceException)
        {
        }

        try
        {
            enemy = enemy.GetComponent <enemy>();
        }
        catch (NullReferenceException)
        {
        }
    }
Exemplo n.º 3
0
 public override ActionResult Execute(RAIN.Core.AI ai)
 {
     body = ai.Body.GetComponentInChildren <enemy>();
     body.GetComponent <Collider>().isTrigger = false;
     body.canBeDamaged = true;
     return(ActionResult.SUCCESS);
 }
Exemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (player != null)
     {
         displayHealth          = player.GetComponent <enemy>().health.ToString();
         coolasshealthtext.text = ("Health:" + displayHealth);
     }
 }
Exemplo n.º 5
0
    IEnumerator stun(enemy e)
    {
        var renderer = e.GetComponent <SpriteRenderer>();

        //goomba.SetBool("stun", true);
        e.enabled      = false;
        renderer.color = new Color(1, 1, 1, .4f);
        yield return(new WaitForSeconds(wait));

        e.enabled      = true;
        renderer.color = new Color(1, 1, 1, 1);
        //goomba.SetBool("stun", false);
    }
Exemplo n.º 6
0
    public void GenerateRooms(Room room, int ind)
    {
        if (room.type == 1)
        {
            GameObject BuyHp  = ShopItems[0];
            GameObject BuyStr = ShopItems[1];
            Instantiate(BuyHp, BuyHp.transform.position, BuyHp.transform.rotation);
            Instantiate(BuyStr, BuyStr.transform.position, BuyStr.transform.rotation);
        }
        float x             = room.gridPos[0];
        float y             = room.gridPos[1];
        bool  canbebossroom = room.openBot && !room.openLeft && !room.openRight && !room.openTop || !room.openBot && room.openLeft && !room.openRight && !room.openTop || !room.openBot && !room.openLeft && room.openRight && !room.openTop || !room.openBot && !room.openLeft && !room.openRight && room.openTop;

        if (!boss && canbebossroom)
        {
            boss = true;
            Vector3 position = new Vector3(room.gridPos.y * 9, 0, room.gridPos.x * 9);
            enemy   Boss     = Bosses[Random.Range(0, Bosses.Length)];
            Boss.GetComponent <enemy>().roomPos = new Vector3(room.gridPos.y * 9 - 3.5f, 0, room.gridPos.x * 9 - 3.5f);
            Instantiate(Boss, position, Quaternion.identity, transform);
        }
        else
        {
            if (ind <= 0 && !powerup)
            {
                powerup = true;
                Texture2D thisroom = poweruprooms[Random.Range(0, poweruprooms.Length)];
                int       length   = thisroom.width;
                for (int i = 0; i < length; i++)
                {
                    for (int j = 0; j < length; j++)
                    {
                        GenerateTile(i, j, thisroom, room);
                    }
                }
            }
            else
            {
                Texture2D thisroom = patterns[Random.Range(0, patterns.Length)];
                int       length   = thisroom.width;
                for (int i = 0; i < length; i++)
                {
                    for (int j = 0; j < length; j++)
                    {
                        GenerateTile(i, j, thisroom, room);
                    }
                }
            }
        }
    }
Exemplo n.º 7
0
 void Start()
 {
     currentAmountEnemies = enemiesAtATime;
     //TODO remember to implement choosing enemy positions
     for (int i = 0; i < currentAmountEnemies; i++)
     {
         enemy e = ObjectPooler.Instance.SpawnFromPool("enemy",
                                                       new Vector2(UnityEngine.Random.Range(-5, 5), UnityEngine.Random.Range(-5, 5)),
                                                       Quaternion.identity).GetComponent <enemy>();
         e.onKillListeners += incKillCount;
         EB_BackAndForth EB = e.GetComponent <EB_BackAndForth>();
         EB.EnemyDirection = (EB_BackAndForth.Direction)UnityEngine.Random.Range(0, 3);
         EB.EnemySpeed     = UnityEngine.Random.Range(-1f, 1f) + EB.EnemySpeed;
         EB.PauseInterval  = UnityEngine.Random.Range(0, 3);
         EB.WalkInterval   = UnityEngine.Random.Range(2, 5);
     }
 }