private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("DurationBoolItem")) { var bonus = other.GetComponent <OnItem>().durationBoolItem; if (AvalaibleDurationItem.Find(item => item.name == bonus.name) == false) { AvalaibleDurationItem.Add(bonus); OnBonusChange.Raise(gameObject); sound.Play("ItemFx"); //BonusImages[BonusCount - 1].sprite = bonus.ItemIcon; } else { var ExistingBonus = AvalaibleDurationItem.Find(item => item.name == bonus.name); ExistingBonus._durationItemTimer = 0; sound.Play("ItemFx"); } if (bonus.ActivateBoolBonus[PlayerID].Value == false) { bonus._durationItemTimer = 0; bonus.Activate(bonus.ActivateBoolBonus[PlayerID]); sound.Play("ItemFx"); } Destroy(other.gameObject); } if (other.CompareTag("UntilDeathBoolItem")) { var bonus = other.GetComponent <OnItem>().untilDeathBool; if (AvalaibleUntilDeathItem.Find(item => item.name == bonus.name) == false) { AvalaibleUntilDeathItem.Add(bonus); OnBonusChange.Raise(gameObject); sound.Play("ItemFx"); //BonusImages[BonusCount - 1].sprite = bonus.ItemIcon; } bonus.Activate(bonus.ActivateBoolBonus[PlayerID]); Destroy(other.gameObject); } if (other.CompareTag("SpecialEffectItem")) { var bonus = other.GetComponent <OnItem>().specialEffectItem; bonus.GetList(); bonus.SpecialBonusEffect(this.transform); sound.Play("Inversion"); Destroy(other.gameObject); } if (other.CompareTag("InstantItem")) { var bonus = other.GetComponent <OnItem>().instantFloatItem; bonus.ActivateFloat(PlayerID); sound.Play("Points"); Destroy(other.gameObject); } }
void OnGetDamage(int damage) { if (ShieldActive.Value == false) { scoreComponent.incrementTimer = 0f; CurrentHP -= (float)damage; sound.Play("HurtFx"); if (CurrentHP <= 0) { playerDead.Raise(this.gameObject); CurrentHP = _health.MaxHP; } } }
void OnGetDamage(int damage) { if (ShieldActive.Value == false) { scoreComponent.incrementTimer = 0f; CurrentHP -= damage; sound.Play("HurtFx"); if (CurrentHP <= 0) { Instantiate(PlayerDeathPrefab, transform.position, Quaternion.identity); playerDead.Raise(gameObject); CurrentHP = _health.MaxHP; } } }
public override void OnInspectorGUI() { GameObjectEvent script = (GameObjectEvent)target; //Event Description GUILayout.BeginVertical(); EditorGUILayout.LabelField("Event Description", EditorStyles.centeredGreyMiniLabel); EditorStyles.textField.wordWrap = true; script.EventDescription = EditorGUILayout.TextArea(script.EventDescription, GUILayout.MinHeight(100)); GUILayout.EndVertical(); //Test Event Button GUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("Test Event", EditorStyles.centeredGreyMiniLabel); value = (GameObject)EditorGUILayout.ObjectField("Value", value, typeof(GameObject), true); if (GUILayout.Button("Raise")) { if (Application.isPlaying) { script.Raise(value); } } GUILayout.EndVertical(); }
public void Shake() { if (shakeEvent) { shakeEvent.Raise(gameObject); } }
public void ActivateWormhole() { if (ActivateWormholeEvent) { ActivateWormholeEvent.Raise(gameObject); } }
private void Update() { bool anyButton = controllerEvents.AnyButtonPressed(); if (!this.anyButton && anyButton) { anyButtonPressed.Raise(controllerEvents.gameObject); } this.anyButton = anyButton; }
protected void OnHook() { if (_event != null) { _event.Raise(); } if (_eventWithGameObjectReference != null) { _eventWithGameObjectReference.Raise(_selectGameObjectReference != null ? _selectGameObjectReference.Call(gameObject) : gameObject); } }
public void GetDamage(int amount) { currentHealth -= amount; if (currentHealth <= 0) { Debug.Log("DEATH OF " + gameObject.name); Debug.Log("DEATH HAS BEEN RAISED!"); deathEvent.Raise(gameObject); deathAction.Do(gameObject); } }
// Do damage to enemy unit public void DamageEnemy(int dmg) { this.health -= dmg; if (this.health <= 0) { // Drop loot GameObject newLoot = Instantiate(this.loot, this.transform.position, Quaternion.identity); allLoot.Add(newLoot); OnLootDropedEvent.Raise(newLoot); // Destroy enemy Destroy(gameObject); } }
private void OnTriggerEnter(Collider other) { var body = other.GetComponent <Rigidbody>(); if (body && !trappedObjects.Contains(body)) { trappedObjects.Add(body); var player = other.GetComponent <PlayerInput>(); if (player) { player.InputEnabled = false; PlayerTrappedEvent.Raise(player.gameObject); } } }
private void Update() { var ray = new Ray(_camera.transform.position, _camera.transform.forward); var hitSomething = Physics.SphereCast(ray, raySphereRadius, out var hitInfo, rayDistance, interactableLayer); if (!hitSomething) { interactFeedbackText.text = ""; interactFeedbackText.enabled = false; return; } interactFeedbackText.text = hitInfo.transform.name; interactFeedbackText.enabled = true; if (!interactionInputData.InteractClicked) { return; } interactedEvent.Raise(hitInfo.transform.gameObject); }
public void StartTimeTravel() { OnSnakeTimeTravel.Raise(gameObject); }
public override void CollectPowerUp() { base.CollectPowerUp(); OnGetTimeTravelBlock.Raise(gameObject); }
private void Start() { _spawnedEvent.Raise(gameObject); }
public override void OnCursorClick() { base.OnCursorClick(); OnDeviceSelected.Raise(DevicePrefab); }