Ejemplo n.º 1
0
    public void DamageAdjecentHoneycomb(int depth)
    {
        HoneycombPos hexPos = Utility.WorldPointToHoneycombGrid(honeyGrid.position);

        Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(0, 1)).DamageHoneycomb(depth);
        Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(1, 1)).DamageHoneycomb(depth);
        Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(1, -1)).DamageHoneycomb(depth);
        Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(0, -1)).DamageHoneycomb(depth);
        Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(-1, -1)).DamageHoneycomb(depth);
        Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(-1, 1)).DamageHoneycomb(depth);
    }
Ejemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Honeycomb"))
        {
            //Destroy(collision.gameObject);
            if (honeycombBounce)
            {
                Vector2 velocity = GetComponent <Rigidbody2D>().velocity;
                Vector2 normal   = collision.transform.position - transform.position;
            }
            else
            {
                HoneycombPos hexPos = Utility.WorldPointToHoneycombGrid(collision.GetComponent <Honeycomb>().honeyGrid.position);
                collision.GetComponent <Honeycomb>().DamageHoneycomb(Damage);
                if (false) //for testing HoneycombPos.GetAdjecentHoneycomb()
                {
                    Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(0, 1)).honeycomb.GetComponent <Honeycomb>().DamageHoneycomb(10);
                    Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(1, 1)).honeycomb.GetComponent <Honeycomb>().DamageHoneycomb(10);
                    Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(1, -1)).honeycomb.GetComponent <Honeycomb>().DamageHoneycomb(10);
                    Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(0, -1)).honeycomb.GetComponent <Honeycomb>().DamageHoneycomb(10);
                    Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(-1, -1)).honeycomb.GetComponent <Honeycomb>().DamageHoneycomb(10);
                    Map.StaticMap.GetHoneycomb(hexPos.GetAdjecentHoneycomb(-1, 1)).honeycomb.GetComponent <Honeycomb>().DamageHoneycomb(10);
                }
                Destroy(gameObject);
            }
        }

        if (collision.transform.CompareTag("Enemy") && collision.transform.GetComponent <Insect>())
        {
            Insect collider = collision.transform.GetComponent <Insect>();


            collider.TakeDamage(Damage);
            FindObjectOfType <LevelHandler>().UpdatePlayerStats(1, 0);
            Destroy(gameObject);
        }
    }