public override void Execute(Context _context) { // action logic here //if( context.target == null) return; context = (BaseContext) _context; context.alive = false; // Debug.Log("Destroy" + context.gameObject.name); // context.StartCoroutine(WaitAndDestroy() ); if(context.lastHit != null){ pc = context.lastHit.GetComponent<PlayerContext>(); player = GameObject.FindObjectOfType(typeof(PlayerContext)) as PlayerContext; } if(context.team == 1 && pc == null) { // player.streak = 0; } else if(context.team == 1 && pc != null){ player.streak += 1; DisplayBounty(); } GameObject.Destroy(context.gameObject); }
void Start() { context= FindObjectOfType(typeof(PlayerContext)) as PlayerContext; info = context.GetType().GetField(fieldName); label = GetComponent<UILabel>(); }