Esempio n. 1
0
        //Player Listener
        private void PlayerAction(Player.PlayerAction playerAction)
        {
            switch (playerAction)
            {
            case Player.PlayerAction.reflect:
                if (player.rBody.velocity.x != 0)
                {
                    CamRotation.ReflectRotationSwitch(player, reflectRotationSwitchDuration);
                }
                break;

            case Player.PlayerAction.charge:
                CamZoom.ZoomToVelocity(player, defaultTransitionDuration);
                CamRotation.RotateToVelocity(player, defaultTransitionDuration);
                break;

            case Player.PlayerAction.decharge:
                CamRotation.RotateToVelocity(player, defaultTransitionDuration);
                break;

            case Player.PlayerAction.teleport:
                CamMove.StopFollowing();
                CamMove.MoveCamTo(Player.destinationPortal.transform.position, player.teleportDuration);
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
    public void Fire(Player.PlayerAction action)
    {
        GameObject g = Instantiate(bullet, transform.position, Quaternion.identity);

        g.GetComponent <TelekinesisProjectile>().action = action;
        switch (controller.faceDir)
        {
        case Controller2D.Direction.North:

            //g.GetComponent<Rigidbody2D>().AddForce(Vector2.up * 5, ForceMode2D.Impulse);
            g.GetComponent <TelekinesisProjectile>().Cast(90);

            break;

        case Controller2D.Direction.South:
            g.GetComponent <TelekinesisProjectile>().Cast(270);
            //g.GetComponent<Rigidbody2D>().AddForce(Vector2.down * 5, ForceMode2D.Impulse);
            break;

        case Controller2D.Direction.East:
            g.GetComponent <TelekinesisProjectile>().Cast(0);
            //g.GetComponent<Rigidbody2D>().AddForce(Vector2.right * 5, ForceMode2D.Impulse);
            break;

        case Controller2D.Direction.West:
            g.GetComponent <TelekinesisProjectile>().Cast(180);
            //g.GetComponent<Rigidbody2D>().AddForce(Vector2.left * 5, ForceMode2D.Impulse);
            break;
        }
    }
Esempio n. 3
0
        public void Load(Player.PlayerAction action, Player.PlayerFacing facing)
        {
            if (action == Player.PlayerAction.Walking || action == Player.PlayerAction.Sneaking)
            {
                if (facing == Player.PlayerFacing.Front)
                {
                    front.Load();
                }

                if (facing == Player.PlayerFacing.Back)
                {
                    back.Load();
                }

                if (facing == Player.PlayerFacing.Left)
                {
                    left.Load();
                }

                if (facing == Player.PlayerFacing.Right)
                {
                    right.Load();
                }
            }

            if (action == Player.PlayerAction.Attacking)
            {
                if (facing == Player.PlayerFacing.Front)
                {
                    attackFront.Load();
                }

                if (facing == Player.PlayerFacing.Back)
                {
                    attackBack.Load();
                }

                if (facing == Player.PlayerFacing.Left)
                {
                    attackLeft.Load();
                }

                if (facing == Player.PlayerFacing.Right)
                {
                    attackRight.Load();
                }
            }
        }
Esempio n. 4
0
 public void Update()
 {
     startTime             = game.startTime;
     renderFreq            = (float)game.RenderFrequency;
     updateFreq            = (float)game.UpdateFrequency;
     gameTime              = game.time;
     amountChunksGenerated = game.world.GetAmountChunksGenerated();
     chunkPlayerIsIn       = game.world.GetChunkAtPlayer();
     player       = game.world.player;
     playerLoc    = player.GetLocation();
     playerAction = player.GetAction();
     playerFacing = player.GetFacing();
     garbage1     = GC.CollectionCount(1);
     garbage2     = GC.CollectionCount(2);
     garbage3     = GC.CollectionCount(3);
 }
Esempio n. 5
0
    public void TriggerQuest(Player player, Player.PlayerAction action)
    {
        List <Quest> validActionQuests = quests.FindAll(q => q.trigger.action == action);

        validActionQuests.Sort((q1, q2) => q2.trigger.probability.CompareTo(q1.trigger.probability));

        foreach (Quest quest in validActionQuests)
        {
            float random = Random.value * 100f;

            if (quest.trigger.probability < random)
            {
                continue;
            }

            questQueue.Enqueue(new Tuple <Quest, Player>(quest, player));
            break;
        }
    }
Esempio n. 6
0
        //Listener
        private void PlayerAction(Player.PlayerAction playerAction)
        {
            switch (playerAction)
            {
            case Player.PlayerAction.reflect:
                soundPlayer.RandomizeSfx(reflectSound);
                break;

            case Player.PlayerAction.charge:
                //soundPlayer.PlaySingle(chargeSound);
                break;

            case Player.PlayerAction.decharge:
                break;

            default:
                break;
            }
        }
Esempio n. 7
0
 public void SetAction(Player.PlayerAction action)
 {
     this.action = action;
 }
Esempio n. 8
0
    IEnumerator Dialoging(Player.PlayerAction action)
    {
        yield return(new WaitForSeconds(dialogueDelay));

        action.Invoke();
    }
Esempio n. 9
0
 public void EndDialogue(Player.PlayerAction action)
 {
     OnEndTalk.Invoke();
     StartCoroutine(Dialoging(action));
     dialogueDelay = 0;
 }