Ejemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // Debug.Log(other.tag);
        rb2d.velocity = new Vector2(0, 0);
        if (other.tag == "Player")
        {
            AttackPlayer(other.gameObject);
        }

        else if (other.tag == "Wall")
        {
            wallObject = other.gameObject;
            // Debug.Log(wallObject.tag);

            wall  = other;
            aWall = wallObject.GetComponent <WallHealth>();

            AttackWall(wall);


            //  Debug.Log(aWall.curHealth);
        }
        else if (other.tag == "Archer")
        {
            AttackArcher(other.gameObject);
        }
        else if (other.tag == "Arrow")
        {
            Injured();
        }
    }
Ejemplo n.º 2
0
    public void RpcResetWalls()
    {
        Debug.Log("reset walls rpc");
        NextWallToBuild = 0;
        //foreach deactivate
        int c = 0;

        foreach (wallLevels wallLevel in wallLevelGroup)
        {
            if (wallLevel.Level.activeInHierarchy)
            {
                Debug.Log(wallLevel.Level.transform.childCount);
                for (int i = 0; i < wallLevel.walls.Count; i++)
                {
                    Debug.Log("Working on Wall " + i);
                    WallHealth wallScript = wallLevel.walls[i].GetComponent <WallHealth>();

                    wallScript.CmdTakeDamage1(wallScript.maxHealth);
                    //Why no blob spawn?
                    wallScript.ResetWall();
                }
                BuilderModel[c].SetActive(false);
                c++;
                wallLevel.Level.SetActive(false);
                Debug.Log("Walls turned off");
            }
        }
    }
 private void OnTriggerEnter(Collider other)
 {
     //Used to stop the hitbox from dealing too much damage to each individual Gates
     if (other.gameObject.tag == "Gate" && !stopIt)
     {
         WallHealth _wHp = FindObjectOfType <WallHealth>();
         StartCoroutine(DamageWall(_wHp));
     }
 }
    private IEnumerator DamageWall(WallHealth wall)
    {
        wall.TakeDamage(300);
        damagePause = true;
        yield return(new WaitForSeconds(0.05f));

        damagePause = false;
        stopIt      = true;
    }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {

        player1 = GameObject.FindGameObjectWithTag("Player");
        player2 = GameObject.FindGameObjectWithTag("Player2");
        Wall1 = GameObject.FindGameObjectWithTag("Wall1");
        Wall2 = GameObject.FindGameObjectWithTag("Wall2");
        playerScript = gameObject.GetComponent<HealthScript>();
        enemyScript = gameObject.GetComponent<EnemyHealth>();
        armorScript = gameObject.GetComponent<WallHealth>();
        anim = GetComponent<Animator>();

    }
Ejemplo n.º 6
0
    public void RpcDeactivateWallLevels()
    {
        int c = 0;

        foreach (wallLevels wallLevel in wallLevelGroup)
        {
            if (wallLevel.Level.activeInHierarchy)
            {
                Debug.Log(wallLevel.Level.transform.childCount);
                for (int i = 0; i < wallLevel.walls.Count; i++)
                {
                    Debug.Log("Working on Wall " + i);
                    WallHealth wallScript = wallLevel.walls[i].GetComponent <WallHealth>();

                    //Why no blob spawn?
                    wallScript.ResetWall();
                }
                c++;
                wallLevel.Level.SetActive(false);
                Debug.Log("Walls turned off");
            }
        }
    }
 private void Start()
 {
     // хотел сделать через Inject, но там бага
     // https://github.com/modesttree/Zenject/issues/275
     _wallHealth = GetComponentInParent <WallHealth>();
 }
Ejemplo n.º 8
0
 void Start()
 {
     wallHealth = this.gameObject.AddComponent<WallHealth>();
     wallHealth.SetParent(this);
     wallHealth.SetHealth(10);
 }