public void OnBlockAttached(FallingBlock fallingBlock) { animator.SetTrigger(wheatDroppedAnimHash); ++AttachedBlocksCounter; lethalRange.DestroyEntitiesInRange(); }
// invoked by animator events void ThrowRock(int rockIndex) { var rockToThrow = projectiles.ElementAtOrDefault(rockIndex); if (rockToThrow == null) { var spawnSlot = spawnSlots.ElementAtOrDefault(rockIndex); if (spawnSlot != null) { var spawnedProjectile = Instantiate(rockPrefab, spawnSlot.transform) .GetComponent <CatapultRock>(); projectiles.Add(spawnedProjectile); //thisAudioSource.clip = SoundManager.Instance.CatapultShot; //thisAudioSource.PlayOneShot(SoundManager.Instance.CatapultShot); } } if (parentBlock == null) { parentBlock = GetComponentInParent <FallingBlock>(); } if (rockToThrow != null && parentBlock != null) { rockToThrow.Launch(parentBlock.transform.right); projectiles.Remove(rockToThrow); } }
void OnAnyBlockSpawned(FallingBlock fallingBlock) { if (currentFallingBlock != null) { return; } currentFallingBlock = fallingBlock; currentFallingBlock.IsSelected = true; }
void OnAnyBlockPlaced(FallingBlock fallingBlock) { if (currentFallingBlock != fallingBlock) { return; } currentFallingBlock.IsSelected = false; currentFallingBlock = null; shouldSpawnNextBlock = true; }
void Awake() { animator = GetComponent <Animator>(); thisAudioSource = GetComponent <AudioSource>(); parentBlock = GetComponentInParent <FallingBlock>(); }