Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        public override void PerformDrag()
        {
            ThrowableObject thrownObject = AnturaSpaceScene.DragObject(throwingObjectPrefabGO);

            if (thrownObject != null)
            {
                thrownObject.OnDeath += RefreshAction;
            }
            CommitAction();
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        private void InteractWithCurrentObject()
        {
            if (objectToCatch.Edible)
            {
                controller.EatObject(objectToCatch);
            }
            else
            {
                controller.HitObject(objectToCatch);
            }

            objectToCatch           = null;
            objectInteracted        = false;
            controller.CurrentState = controller.Idle;
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        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;
        }
Beispiel #8
0
        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);
            }
        }