public void EatObject(ThrowableObject throwableObject) { if (spawnedObjects.Remove(throwableObject)) { AudioManager.I.PlaySound(Sfx.EggMove); var poof = Instantiate(PoofPrefab).transform; poof.position = throwableObject.transform.position; foreach (var ps in poof.GetComponentsInChildren <ParticleSystem>()) { var main = ps.main; main.scalingMode = ParticleSystemScalingMode.Hierarchy; } poof.localScale = poof.localScale * 0.5f; poof.gameObject.AddComponent <AutoDestroy>().duration = 2; AudioManager.I.PlaySound(Sfx.Poof); AnturaHappiness += 0.2f; if (AnturaHappiness > 1) { AnturaHappiness = 1; } if (onEatObject != null) { onEatObject(); } Destroy(throwableObject.gameObject); } }
public override void PerformDrag() { ThrowableObject thrownObject = AnturaSpaceScene.DragObject(throwingObjectPrefabGO); if (thrownObject != null) { thrownObject.OnDeath += RefreshAction; } CommitAction(); }
private ThrowableObject SpawnNewObject(ThrowableObject ObjectPrefab) { Antura.BoneSmell(); var newObjectGo = Instantiate(ObjectPrefab.gameObject); newObjectGo.SetActive(true); newObjectGo.transform.position = ObjectSpawnPivotTr.position; var throwableObject = newObjectGo.GetComponent <ThrowableObject>(); spawnedObjects.Add(throwableObject); return(throwableObject); }
private void InteractWithCurrentObject() { if (objectToCatch.Edible) { controller.EatObject(objectToCatch); } else { controller.HitObject(objectToCatch); } objectToCatch = null; objectInteracted = false; controller.CurrentState = controller.Idle; }
public ThrowableObject ThrowObject(ThrowableObject ObjectPrefab) { if (DraggedTransform != null) { return(null); } if (CanSpawnMoreObjects) { AudioManager.I.PlaySound(Sfx.ThrowObj); var throwableObject = SpawnNewObject(ObjectPrefab); throwableObject.SimpleThrow(); return(throwableObject); } return(null); }
public ThrowableObject DragObject(ThrowableObject ObjectPrefab) { if (DraggedTransform != null) { return(null); } if (CanSpawnMoreObjects) { ShopDecorationsManager.I.SetContextNewPlacement(); var throwableObject = SpawnNewObject(ObjectPrefab); DraggedTransform = throwableObject.transform; throwableObject.Drag(); throwableObject.OnRelease += ShopDecorationsManager.I.SetContextPurchase; return(throwableObject); } return(null); }
public override void EnterState() { base.EnterState(); var newObjectToCatch = controller.NextObjectToCatch; if (newObjectToCatch == null) { controller.CurrentState = controller.Idle; return; } objectToCatch = newObjectToCatch; objectInteracted = false; controller.Antura.SetTarget(objectToCatch.transform, false); objectRigidBody = objectToCatch.GetComponent <Rigidbody>(); controller.Antura.Excited = true; }
public void HitObject(ThrowableObject throwableObject) { if (spawnedObjects.Remove(throwableObject)) { AudioManager.I.PlaySound(Sfx.EggMove); AnturaHappiness += 0.2f; if (AnturaHappiness > 1) { AnturaHappiness = 1; } if (onHitObject != null) { onHitObject(); } throwableObject.GetComponent <Rigidbody>().AddForce(Vector3.up * 20, ForceMode.Impulse); } }