private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player") && !picked) { PhaseController pc = collision.GetComponent <PhaseController>(); pc.actualAbility = AbilityCreator.CreateAbility(type, pc); if (effect != null) { effect.SetActive(false); } picked = true; coroutine = Pickup(pc); StartCoroutine(coroutine); } }
public override void Load() { Camera.main.transform.position = camPos; transform.position = pos; transform.rotation = rot; transform.localScale = scale; Rigidbody2D rb = GetComponent <Rigidbody2D>(); rb.velocity = Vector2.zero; rb.gravityScale = gravity; PhaseController pc = GetComponent <PhaseController>(); pc.SendRequestToChangePhase(phase); if (ability != SuperAbility.Abilities.None) { pc.actualAbility = AbilityCreator.CreateAbility(ability, pc); } else { pc.ClearAbility(); } }