Beispiel #1
0
        void OnTriggerEnter2D(Collider2D c)
        {
            bool layerCheck = c.gameObject.layer == World2D.world2D.layerPlayerDamage;

            if (layerCheck)
            {
                float wepDamage = c.gameObject.GetComponent <WeaponCode2D>().GetDamage();
                float wepForce  = c.gameObject.GetComponent <WeaponCode2D>().GetForce();

                float wepForceDirection = Lib2D.TriggerDirectionLeft2D(gameObject, c) ? -1 : 1;

                TakeDamage(wepDamage, wepForce, wepForceDirection);
            }
        }
Beispiel #2
0
        void OnCollisionEnter2D(Collision2D c)
        {
            bool layerCheckLevel   = World2D.world2D.layerLevel == c.gameObject.layer;
            bool checkMonsterLayer = World2D.world2D.layerMonster == c.gameObject.layer;

            if (layerCheckLevel || checkMonsterLayer)
            {
                string collisionDirection2D = Lib2D.CollisionDirection2D(c);
                switch (collisionDirection2D)
                {
                case "left":  facingLeft = true;  break;

                case "right": facingLeft = false; break;

                default: break;
                }
            }
        }