protected virtual void PotionHasExpired() { if (potionState == PotionStates.IsExpiring) { return; } potionState = PotionStates.IsExpiring; //SEND Message to loader Debug.Log("potion expired"); this.enabled = false; Destroy(this); }
protected virtual void PotionCollected(GameObject picker) { if (picker.tag != "Player") { return; } if (potionState == PotionStates.IsCollected || potionState == PotionStates.IsExpiring) { return; } //state is attract,then can collect potionState = PotionStates.IsCollected; player = picker.GetComponent <Player>(); //Move to player this.gameObject.transform.SetParent(player.gameObject.transform); this.gameObject.transform.position = player.gameObject.transform.position; PotionEffect(); PotionPayload(); //SEND MESSAGE AND DISABLED //..... //animator.enabled=false; spriteRenderer.enabled = false; }
// Start is called before the first frame update protected virtual void Start() { potionState = PotionStates.InAttractMode; }