protected override void processCollision(Collider2D collision, bool useInitialDamage)
    {
        //If it's a flag, don't teleport it
        Rigidbody2D rb2d = collision.gameObject.FindComponent <Rigidbody2D>();

        if (rb2d && rb2d.gameObject.CompareTag("TeamFlag"))
        {
            return;
        }
        //If it is destroyable,
        HealthPool hp = collision.gameObject.FindComponent <HealthPool>();

        if (hp)
        {
            //It doesn't matter what it is, teleport it
            Vector2 teleportPos = Utility.MouseWorldPos;
            //Check if it's a Unicorn using Rainbow Path
            UnicornController unicorn = collision.gameObject.FindComponent <UnicornController>();
            if (unicorn)
            {
                unicorn.redirectPath(teleportPos);
            }
            //Teleport like usual
            Utility.teleportObject(hp.gameObject, teleportPos);
            //If it's a WeaponController (like the weapons from Astral)
            WeaponController weapon = collision.gameObject.FindComponent <WeaponController>();
            if (weapon)
            {
                //Make it unowned
                weapon.Controller = null;
            }
            //and then destroy this shot
            health.Health = 0;
        }
        else if (!collision.isTrigger)
        {
            //Destroy this shot if object is destroyable
            health.Health = 0;
        }
    }
 private void GivenUnicornController()
 {
     this.unicornController = new UnicornController(this.unishopDbContext);
 }
示例#3
0
 private void Start()
 {
     unicornController = GetComponent <UnicornController>();
     scoreBoard        = GameObject.Find("Scoreboard").GetComponent <ScoreBoardController>();
 }
 private void GivenUnicornController()
 {
     this.unicornController = new UnicornController(this.fakeUnicornService.Object, this.fakeRekognitionService.Object);
 }