public void Collect() { SCR_collectableSpawner.collectableTotal--; SCR_collectableSpawner.spawnPointOccupied[spawnSlot] = 0; isActive = false; fadeCounter = 1.5f; if (collectEffectObj) { GameObject collectEffectInst = Instantiate(collectEffectObj, transform.position, Quaternion.identity) as GameObject; } if (SND_collect) { SND_collect.PlaySound(); if (collectPoints == true) { SCR_main.score += points; if (SCR_main.pOn) { SCR_text p = SCR_gui.CreateText("PopUpPoints", Vector3.zero); p.UpdateText(points.ToString()); p.SetWorldPos(transform.position, 1f); p.SetFadeSpeed(0.55f, 0.2f); } } } flashOn = true; DisplayFlash(); }
void UpdateAction() { character.SetRotAngle(currentTargetEnemy.transform.position); actionCounter += Time.deltaTime; if (action == 0 || action == 1) { if (action == 0) { character.speed[1] = (character.dir * character.runSpeed); if (actionCounter >= actionLimit) { SetAction(1); } } else { if (actionCounter >= actionLimit) { SetAction(0); } } character.SetRotTarget(); CheckPlayerDistance(1); } else { if (action == 2) { //ready to attack character.SetRotTarget(); if (actionCounter >= actionLimit) { SetAction(3); } CheckPlayerDistance(2); } else { if (action == 10) { //dying if (actionCounter >= 1.25f) { if (SCR_main.pOn) { SCR_text p = SCR_gui.CreateText("PopUpPoints", Vector3.zero); p.UpdateText(points.ToString()); p.SetWorldPos(transform.position, 1f); p.SetFadeSpeed(0.55f, 0.2f); } SetAction(11); character.StartFlash(1, 1000); GetComponent <BoxCollider>().isTrigger = true; } } else { if (action == 11) { //vanishing if (actionCounter >= 0.55f) { SCR_main.DestroyObj(gameObject); } } } } } }