Inheritance: InControl.PlayerActionSet
	public static PlayerActions CreateWithJoystickBindings()
	{
		var actions = new PlayerActions();

		actions.Green.AddDefaultBinding( InputControlType.Action1 );
		actions.Red.AddDefaultBinding( InputControlType.Action2 );
		actions.Blue.AddDefaultBinding( InputControlType.Action3 );
		actions.Yellow.AddDefaultBinding( InputControlType.Action4 );

		actions.Up.AddDefaultBinding( InputControlType.LeftStickUp );
		actions.Down.AddDefaultBinding( InputControlType.LeftStickDown );
		actions.Left.AddDefaultBinding( InputControlType.LeftStickLeft );
		actions.Right.AddDefaultBinding( InputControlType.LeftStickRight );

		actions.Up.AddDefaultBinding( InputControlType.DPadUp );
		actions.Down.AddDefaultBinding( InputControlType.DPadDown );
		actions.Left.AddDefaultBinding( InputControlType.DPadLeft );
		actions.Right.AddDefaultBinding( InputControlType.DPadRight );

		actions.RTrigger.AddDefaultBinding( InputControlType.RightTrigger );
		actions.LTrigger.AddDefaultBinding( InputControlType.LeftTrigger );

		actions.Start.AddDefaultBinding( InputControlType.Command );

		return actions;
	}
 // Use this for initialization
 void Start()
 {
     //rb2d = GetComponent<Rigidbody2D>();
         anim = GetComponent<Animator>();
         transform.localScale = new Vector2 (playerScale, playerScale);
         paRef = FindObjectOfType<PlayerActions>();
 }
Example #3
0
 //Singlenton pattern
 void awake()
 {
     if (instance == null)
             instance = this;
         else if (instance != null)
             Destroy (this);
 }
Example #4
0
	void Awake()
	{	
		gameOver = false;

		playerActions = new PlayerActions();

		attackParamsByType = new Dictionary<Elements, ADParams>();
		defenseParamsByType = new Dictionary<Elements, ADParams>();
		runeByLetter = new Dictionary<Letters, Sprite>();
		attackByType = new Dictionary<Elements, Sprite>();

		runeByLetter.Add(Letters.NONE, emptyRune);
		runeByLetter.Add(Letters.ATTACK, attackRune);
		runeByLetter.Add(Letters.DEFEND, defenseRune);
		runeByLetter.Add(Letters.FIRE, fireRune);
		runeByLetter.Add(Letters.WATER, waterRune);
		runeByLetter.Add(Letters.AIR, airRune);
		runeByLetter.Add(Letters.EARTH, earthRune);

		attackByType.Add(Elements.FIRE, fireAttack);
		attackByType.Add(Elements.WATER, waterAttack);
		attackByType.Add(Elements.AIR, airAttack);
		attackByType.Add(Elements.EARTH, earthAttack);

		attackParamsByType.Add(Elements.FIRE, fireAttackParams);
		attackParamsByType.Add(Elements.WATER, waterAttackParams);
		attackParamsByType.Add(Elements.AIR, airAttackParams);
		attackParamsByType.Add(Elements.EARTH, earthAttackParams);

		defenseParamsByType.Add(Elements.FIRE, fireDefenseParams);
		defenseParamsByType.Add(Elements.WATER, waterDefenseParams);
		defenseParamsByType.Add(Elements.AIR, airDefenseParams);
		defenseParamsByType.Add(Elements.EARTH, earthDefenseParams);

	}
	void OnEnable()
	{
		InputManager.OnDeviceDetached += OnDeviceDetached;

		keyboardListener1 = PlayerActions.CreateWithKeyboardBindings1();
		keyboardListener2 = PlayerActions.CreateWithKeyboardBindings2();

		joystickListener = PlayerActions.CreateWithJoystickBindings();
	}
 void Awake()
 {
     joyRect = GameObject.Find("GUIComponents/JoyPad").guiTexture.pixelInset;
     joyMid = new Vector2(joyRect.x + joyRect.width / 2f, joyRect.y + joyRect.height / 2f);
     joyDot = joyMid;
     actions = (PlayerActions)GameObject.Find("Player").GetComponent("PlayerActions");
     joyTexture = GameObject.Find("GUIComponents/JoyDot").guiTexture;
     joyTexture.enabled = false;
 }
    public PlayerStates validateNewAction(PlayerActions newAction)
    {
        if(transitions.ContainsKey(newAction))
        {
            return transitions[newAction];
        }

        return PlayerStates.NULL;
    }
Example #8
0
    public SearchState(AIController aiController)
    {
        this.aiController = aiController;
        playerActions = aiController.GetComponent<PlayerActions>();
        pathManager = aiController.GetComponent<PathFinderManager>();

		ChooseNewTarget();
		lastPositionTarget = target;
    }
Example #9
0
    // Use this for initialization
    void Start()
    {
        playerObj = GameObject.Find("Hero");
        playerScript = playerObj.GetComponent<PlayerActions>();

        button = GameObject.Find("DefenceButton").GetComponent<Button>();
        EventTriggerListener.Get(button.gameObject).onDown = OnButtonDown;
        EventTriggerListener.Get(button.gameObject).onUp = OnButtonUp;
        //EventTriggerListener.Get(button.gameObject).onClick = OnButtonClick;
    }
    void Start()
    {
        // create player actions (not the same as in SimpleCharacterController, since
        // this stuff here will be ignored by the Oculus (I hope))
        actions = PlayerActions.CreateWithDefaultBindings();

        // invert Y axis if necessary
        actions.CamMove.InvertYAxis = settings.invertYAxis;

        FreeMove = false;
    }
 private static void UpdateKeyBinding(string key, PlayerActions playerAction)
 {
     if(_keyBindings.ContainsKey(key))
     {
         _keyBindings[key] = playerAction;
     }
     else
     {
         _keyBindings.Add(key, playerAction);
     }
 }
Example #12
0
    public void Awake()
    {
        playerActions = GameObject.Find("PlayerActions").GetComponent<PlayerActions>();

        hexaCube = (Object.Instantiate(HexaCubePrefab) as GameObject).GetComponent<HexaCube>();
        hexaCube.transform.parent = transform;
        hexaCube.transform.localPosition = Vector3.zero;
        hexaCube.gridPlace = this;
        displayTransform = hexaCube.transform.FindChild("LookRotation");

        targetScale = Vector3.one;
    }
Example #13
0
    // Use this for initialization
    void Start()
    {
        m_tansform = this.transform;
        m_animation = this.GetComponent<SkeletonAnimation>();
        playerObj = GameObject.Find("Hero");
        m_playerScript = playerObj.GetComponent<PlayerActions>();

        //m_animation.state.Event += state_Event;
        m_animation.state.End += state_End;

        m_audioManager = GameObject.Find("Audios").GetComponent<AudioManager>();
    }
Example #14
0
    // Use this for initialization
    void Start()
    {
        var kvp = PlayerManager.Instance.GetPlayerFor( this.MatchupForPlayers );
        if (kvp.HasValue)
        {
            this.IsActive = true;

            this.PlayerColor = kvp.Value.Key;
            this.playerActions = kvp.Value.Value;

            StartCoroutine( this.SpawnPlayer() );
        }
    }
Example #15
0
    void Start () {
        rb = GetComponent<Rigidbody2D>();
        tr = transform;
        actions = PlayerActions.CreateActionSet();
        canDodge = true;
        velocity = new Vector2();
        facingRight = true;
        myHealth = GetComponent<Health>();
        myHealth.RestoreHealth(maxHealth);
        myHealth.vulnerable = true;
        anim = GetComponent<Animator>();
		this.audio = this.GetComponent<AudioSource> ();
    }
Example #16
0
    public void AssignPlayerActions(PlayerActions playerActions)
    {
        Debug.Log("PlayerSelect.AssignPlayerActions() " + playerActions.Device.Name);

        this.PlayerActions = playerActions;

        this.AssignControllerText.SetActive(false);
        this.SelectionPanel.gameObject.SetActive(true);

        this.SelectStartingColor();

        StartCoroutine("CheckGamepadInput");
    }
Example #17
0
    public static PlayerActions CreateActionSet() {
        var actions = new PlayerActions();

        actions.moveLeft.AddDefaultBinding(Key.A);
        actions.moveRight.AddDefaultBinding(Key.D);
        actions.moveUp.AddDefaultBinding(Key.W);
        actions.moveDown.AddDefaultBinding(Key.S);

        actions.prevSpell.AddDefaultBinding(Key.Q);
        actions.nextSpell.AddDefaultBinding(Key.E);

        actions.dodge.AddDefaultBinding(Key.Space);

        return actions;
    }
Example #18
0
    public void Init(PlayerActions input)
    {
        distanceFromCenter = 500;
        availableActions = GetComponents<actionController>();
        currentInvul = invulPeriod;
        keyboardListener = PlayerActions.BindActionsWithKeyboard();
        controllerListener = PlayerActions.BindActionsWithController();
        initializeLocalUi();
        initializeInfoUi();
        setupLocalCamera();
        tag = "Player" + playerNumber.ToString();
        setupActions(input);

        isInitialized = true;
    }
Example #19
0
    public bool validateNewAction(PlayerActions newAction)
    {
        FSMState result = getCurrentState();

        PlayerStates newState = result.validateNewAction(newAction);

        if(newState.Equals(PlayerStates.NULL))
        {
            return false;
        }
        else
        {
            currentState=newState;
            return true;
        }
    }
	public static PlayerActions CreateWithKeyboardBindings1()
	{
		var actions = new PlayerActions();

		actions.Green.AddDefaultBinding( Key.O );
		actions.Red.AddDefaultBinding( Key.P );
		actions.Blue.AddDefaultBinding( Key.I );

		actions.Up.AddDefaultBinding( Key.UpArrow );
		actions.Down.AddDefaultBinding( Key.DownArrow );
		actions.Left.AddDefaultBinding( Key.LeftArrow );
		actions.Right.AddDefaultBinding( Key.RightArrow );
		actions.Start.AddDefaultBinding( Key.Return );

		return actions;
	}
	public static PlayerActions CreateWithKeyboardBindings2()
	{
		var actions = new PlayerActions();

		actions.Green.AddDefaultBinding( Key.V );
		actions.Red.AddDefaultBinding( Key.B );
		actions.Blue.AddDefaultBinding( Key.N );

		actions.Up.AddDefaultBinding( Key.W );
		actions.Down.AddDefaultBinding( Key.S );
		actions.Left.AddDefaultBinding( Key.A );
		actions.Right.AddDefaultBinding( Key.D );
		actions.Start.AddDefaultBinding( Key.Return );

		return actions;
	}
Example #22
0
    public static PlayerActions BindActionsWithKeyboard()
    {
        PlayerActions actions = new PlayerActions();

        actions.up.AddDefaultBinding(Key.W);
        actions.down.AddDefaultBinding(Key.S);
        actions.left.AddDefaultBinding(Key.A);
        actions.right.AddDefaultBinding(Key.D);

        actions.primary.AddDefaultBinding(Key.Space);
        actions.secondary.AddDefaultBinding(Key.RightShift);
        actions.shield.AddDefaultBinding(Key.Slash);
        actions.item.AddDefaultBinding(Key.Period);

        actions.pause.AddDefaultBinding(Key.Escape);
        actions.quit.AddDefaultBinding(Key.F1);

        return actions;
    }
Example #23
0
    public static PlayerActions Create()
    {
        PlayerActions actions = new PlayerActions();

        actions.L_Left.AddDefaultBinding(InputControlType.LeftStickLeft);
        actions.L_Right.AddDefaultBinding(InputControlType.LeftStickRight);
        actions.L_Down.AddDefaultBinding(InputControlType.LeftStickDown);
        actions.L_Up.AddDefaultBinding(InputControlType.LeftStickUp);

        actions.R_Left.AddDefaultBinding(InputControlType.RightStickLeft);
        actions.R_Right.AddDefaultBinding(InputControlType.RightStickRight);
        actions.R_Down.AddDefaultBinding(InputControlType.RightStickDown);
        actions.R_Up.AddDefaultBinding(InputControlType.RightStickUp);

        actions.Fire.AddDefaultBinding(InputControlType.RightTrigger);
        actions.Join.AddDefaultBinding(InputControlType.Action1);

        actions.IsKeyboard = false;

        return actions;
    }
Example #24
0
    public static PlayerActions CreateWithDefaultBindings()
    {
        var playerActions = new PlayerActions();

        playerActions.Jump.AddDefaultBinding( Key.Space );
        playerActions.Jump.AddDefaultBinding( InputControlType.Action1 );

        playerActions.Left.AddDefaultBinding( Key.LeftArrow );
        playerActions.Right.AddDefaultBinding( Key.RightArrow );

        playerActions.Left.AddDefaultBinding( InputControlType.LeftStickLeft );
        playerActions.Right.AddDefaultBinding( InputControlType.LeftStickRight );

        playerActions.Left.AddDefaultBinding( InputControlType.DPadLeft );
        playerActions.Right.AddDefaultBinding( InputControlType.DPadRight );

        playerActions.Shift.AddDefaultBinding (Key.Shift);
        playerActions.Shift.AddDefaultBinding (InputControlType.Action2);

        return playerActions;
    }
Example #25
0
    public static PlayerActions BindActionsWithController()
    {
        PlayerActions actions = new PlayerActions();

        actions.up.AddDefaultBinding(InputControlType.LeftStickUp);
        actions.down.AddDefaultBinding(InputControlType.LeftStickDown);
        actions.left.AddDefaultBinding(InputControlType.LeftStickLeft);
        actions.right.AddDefaultBinding(InputControlType.LeftStickRight);

        actions.primary.AddDefaultBinding(InputControlType.Action1);
        actions.secondary.AddDefaultBinding(InputControlType.Action2);
        actions.shield.AddDefaultBinding(InputControlType.LeftBumper);
        actions.item.AddDefaultBinding(InputControlType.RightBumper);

        actions.pause.AddDefaultBinding(InputControlType.Start);
        actions.pause.AddDefaultBinding(InputControlType.Menu);

        actions.quit.AddDefaultBinding(InputControlType.Back);
        actions.quit.AddDefaultBinding(InputControlType.View);

        return actions;
    }
Example #26
0
    public static PlayerActions Create()
    {
        PlayerActions playerActions = new PlayerActions();

        //Move
        playerActions.LeftMove.AddDefaultBinding(Key.LeftArrow);
        playerActions.RightMove.AddDefaultBinding(Key.RightArrow);
        playerActions.UpMove.AddDefaultBinding(Key.UpArrow);
        playerActions.DownMove.AddDefaultBinding(Key.DownArrow);

        playerActions.LeftMove.AddDefaultBinding(InputControlType.LeftStickLeft);
        playerActions.RightMove.AddDefaultBinding(InputControlType.LeftStickRight);
        playerActions.UpMove.AddDefaultBinding(InputControlType.LeftStickUp);
        playerActions.DownMove.AddDefaultBinding(InputControlType.LeftStickDown);

        playerActions.LeftMove.AddDefaultBinding(InputControlType.DPadLeft);
        playerActions.RightMove.AddDefaultBinding(InputControlType.DPadRight);
        playerActions.UpMove.AddDefaultBinding(InputControlType.DPadUp);
        playerActions.DownMove.AddDefaultBinding(InputControlType.DPadDown);

        //Aim
        playerActions.LeftAim.AddDefaultBinding(InputControlType.RightStickLeft);
        playerActions.RightAim.AddDefaultBinding(InputControlType.RightStickRight);
        playerActions.UpAim.AddDefaultBinding(InputControlType.RightStickUp);
        playerActions.DownAim.AddDefaultBinding(InputControlType.RightStickDown);

        //Shoot
        playerActions.Shoot.AddDefaultBinding(Key.LeftControl);
        playerActions.Shoot.AddDefaultBinding(InputControlType.RightBumper);
        playerActions.Shoot.AddDefaultBinding(InputControlType.RightTrigger);

        //Misc
        playerActions.ListenOptions.IncludeUnknownControllers = true;

        return playerActions;
    }
Example #27
0
    // Use this for initialization
    void Start()
    {
        Interface_transform = Interface.transform;
        Interface_Script = Interface.GetComponent<InterfaceManager>();

        playerObj = GameObject.Find("Hero");
        playerScript = playerObj.GetComponent<PlayerActions>();

        button = GameObject.Find("DefenceButton").GetComponent<Button>();
        addButtonListener(button.gameObject);
        DefenceButton = GameObject.Find("DefenceBut");

        m_UI_Hide = UI_Part.GetComponent<UI_PartHide>();

        addButtonListener(WatchADs);
        addButtonListener(GiveUpRevive);
        addButtonListener(RestartButton);
        addButtonListener(HomeButton);
        addButtonListener(reviveButton);
        addButtonListener(StartButton);
        addButtonListener(QuitButton);
        addButtonListener(MusicButton);
        addButtonListener(AudioButton);
        //for (int i = 0; i < m_go.Length; i++)
        //{
        //    addButtonListener(m_go[i]);
        //    isActive[i] = false;
        //}

        Input.multiTouchEnabled = true;
        clickJudgePixels = 1600 * Screen.width / 1080;

        m_gameMaster = GameObject.Find("MainScreen").GetComponent<GameMaster>();
        //EventTriggerListener.Get(button.gameObject).onClick = OnButtonClick;
    }
 // Start is called before the first frame update
 void Start()
 {
     playerActions = gameObject.GetComponentInParent <PlayerActions>();
 }
Example #29
0
 public PlayerActionEventArgs(PlayerActions playerAction, IEnumerable <Meld> melds, Tile actionOnTile = null)
 {
     PlayerAction = playerAction;
     Melds        = melds;
     ActionOnTile = actionOnTile;
 }
    public void Init()
    {
        //get char cont
        if (this.gameObject.GetComponent <CharacterController>() != null)
        {
            charContRef = this.gameObject.GetComponent <CharacterController>();
        }
        else
        {
            charContRef = this.gameObject.AddComponent <CharacterController>();
        }

        //get char cont
        if (this.gameObject.GetComponent <GameInputManager>() != null)
        {
            gameInputManager = this.gameObject.GetComponent <GameInputManager>();
        }
        else
        {
            gameInputManager = this.gameObject.AddComponent <GameInputManager>();
        }


        //get move cont
        if (this.gameObject.GetComponent <PlayerMovement>() != null)
        {
            playerMovement = this.gameObject.GetComponent <PlayerMovement>();
        }
        else
        {
            playerMovement = this.gameObject.AddComponent <PlayerMovement>();
        }
        playerMovement.InitMove(this);

        //get action cont
        if (this.gameObject.GetComponent <PlayerActions>() != null)
        {
            playerActions = this.gameObject.GetComponent <PlayerActions>();
        }
        else
        {
            playerActions = this.gameObject.AddComponent <PlayerActions>();
        }
        playerActions.InitAct(this);

        //get action cont
        if (this.gameObject.GetComponent <PlayerDeath>() != null)
        {
            playerDeath = this.gameObject.GetComponent <PlayerDeath>();
        }
        else
        {
            playerDeath = this.gameObject.AddComponent <PlayerDeath>();
        }

        //get anim
        if (this.gameObject.GetComponent <PlayerAnimation>() != null)
        {
            playerAnimation = this.gameObject.GetComponent <PlayerAnimation>();
        }
        else
        {
            playerAnimation = this.gameObject.AddComponent <PlayerAnimation>();
        }
        playerAnimation.Init();

        //camera
        if (cameraRef == null)
        {
            cameraRef = GameObject.FindObjectOfType <CameraController>();
        }

        playerState = PlayerState.defaultMovement;

        //test
        joyInput = Vector3.zero;
    }
Example #31
0
 private static bool PlayerBusted(PlayerActions currentPlayer)
 {
     return(currentPlayer.GetHandValue() > BLACKJACK);
 }
Example #32
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                LevelOperations.OutputBackups(p, p.level); return;
            }

            string[] args      = message.ToLower().SplitSpaces();
            string   mapArg    = args.Length > 1 ? args[0] : p.level.MapName;
            string   backupArg = args.Length > 1 ? args[1] : args[0];

            string path;

            if (backupArg == currentFlag)
            {
                path = LevelInfo.MapPath(mapArg);
                if (!LevelInfo.MapExists(mapArg))
                {
                    if (Directory.Exists(LevelInfo.BackupBasePath(mapArg)))
                    {
                        p.Message("&WLevel \"{0}\" does not currently exist, &Showever:", mapArg);
                        LevelOperations.OutputBackups(p, mapArg, LevelInfo.GetConfig(mapArg));
                    }
                    else
                    {
                        p.Message("&WLevel \"{0}\" does not exist and no backups could be found.", mapArg);
                    }
                    return;
                }
            }
            else
            {
                if (!Directory.Exists(LevelInfo.BackupBasePath(mapArg)))
                {
                    p.Message("Level \"{0}\" has no backups.", mapArg); return;
                }
                if (backupArg == latestFlag)
                {
                    int latest = LevelInfo.LatestBackup(mapArg);
                    if (latest == 0)
                    {
                        p.Message("&WLevel \"{0}\" does not have any numbered backups, " +
                                  "so the latest backup could not be determined.", mapArg);
                        return;
                    }
                    backupArg = latest.ToString();
                }
                path = LevelInfo.BackupFilePath(mapArg, backupArg);
            }
            if (!File.Exists(path))
            {
                p.Message("Backup \"{0}\" for {1} could not be found.", backupArg, mapArg); return;
            }

            string formattedMuseumName;

            if (backupArg == currentFlag)
            {
                formattedMuseumName = "&cMuseum &S(" + mapArg + ")";
            }
            else
            {
                formattedMuseumName = "&cMuseum &S(" + mapArg + " " + backupArg + ")";
            }

            if (p.level.name.CaselessEq(formattedMuseumName))
            {
                p.Message("You are already in this museum."); return;
            }
            if (Interlocked.CompareExchange(ref p.LoadingMuseum, 1, 0) == 1)
            {
                p.Message("You are already loading a museum level."); return;
            }

            try {
                Level lvl = LevelActions.LoadMuseum(p, formattedMuseumName, mapArg, path);
                PlayerActions.ChangeMap(p, lvl);
            } finally {
                Interlocked.Exchange(ref p.LoadingMuseum, 0);
            }
        }
Example #33
0
 // Use this for initialization
 void Start()
 {
     player        = GetComponent <Player>();
     playerActions = CreateWithDefaultBindings();
 }
 public virtual void CancelAction(SpriteObject spriteObject, PlayerActions playerAction)
 {
 }
 public void CancelAction(SpriteObject spriteObject, PlayerActions playerAction) => Debug.Log($"SpriteObject [{spriteObject.name}] handling cancelled action [{playerAction}]");
Example #36
0
 public PlayerActionEventArgs(PlayerActions playerAction, Tile actionOnTile)
 {
     PlayerAction = playerAction;
     ActionOnTile = actionOnTile;
 }
Example #37
0
 private bool PlayerWins(PlayerActions player)
 {
     // Better score than the dealer, or dealer busted
     return(player.GetHandValue() > _dealer.GetHandValue() || _dealer.GetHandValue() > BLACKJACK);
 }
Example #38
0
        protected override void DoRound()
        {
            Player[] all = allPlayers.Items;
            foreach (Player p in all)
            {
                Get(p).Reset(Config.Difficulty);
                PlayerActions.Respawn(p);
            }

            Red.Score = 0; Blue.Score = 0;
            UpdateAllStatus1();
            UpdateAllStatus2();

            //Announcing Etc.
            // TODO: tidy up
            string Gamemode = "Free For All";

            if (Config.Mode == TWGameMode.TDM)
            {
                Gamemode = "Team Deathmatch";
            }
            string difficulty    = "Normal";
            string HitsToDie     = "2";
            string explosiontime = "medium";
            string explosionsize = "normal";

            switch (Config.Difficulty)
            {
            case TWDifficulty.Easy:
                difficulty    = "Easy";
                explosiontime = "long";
                break;

            case TWDifficulty.Normal:
                difficulty = "Normal";
                break;

            case TWDifficulty.Hard:
                HitsToDie  = "1";
                difficulty = "Hard";
                break;

            case TWDifficulty.Extreme:
                HitsToDie     = "1";
                explosiontime = "short";
                explosionsize = "big";
                difficulty    = "Extreme";
                break;
            }

            string teamkillling = "Disabled";

            if (cfg.TeamKills)
            {
                teamkillling = "Enabled";
            }
            Chat.MessageGlobal("&cTNT Wars &Son " + Map.ColoredName + " &Shas started &3" + Gamemode + " &Swith a difficulty of &3" +
                               difficulty + " &S(&3" + HitsToDie + " &Shits to die, a &3" + explosiontime +
                               " &Sexplosion delay and with a &3" + explosionsize + " &Sexplosion size)" +
                               ", team killing is &3" + teamkillling + " &Sand you can place &3" + cfg.MaxActiveTnt
                               + " &STNT at a time and there is a score limit of &3" + cfg.ScoreRequired + "&S!!");

            if (Config.Mode == TWGameMode.TDM)
            {
                Map.Message("Start your message with ':' to send it to team only!");
            }

            GracePeriod();
            RoundInProgress = true;
            MessageMap(CpeMessageType.Announcement, "&4TNT Wars has started!");

            while (Running && RoundInProgress && !HasSomeoneWon())
            {
                Thread.Sleep(250);
            }
        }
Example #39
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Enemy" && hitTimeEnemy >= 2)
        {
            EnemyAI enemy = col.gameObject.GetComponent <EnemyAI>();

            if (player.animator.GetCurrentAnimatorStateInfo(0).IsName("espadazo") ||
                player.animator.GetCurrentAnimatorStateInfo(0).IsName("espadazo_horizontal"))
            {
                if (!enemyAnimator.GetCurrentAnimatorStateInfo(0).IsName("blocking") &&
                    !enemyAnimator.GetCurrentAnimatorStateInfo(0).IsName("block"))
                {
                    //Debug.Log("Enemy life: " + enemy.life);
                    enemy.currentHealth -= 1;
                    enemy.healthBar.setHealth(enemy.currentHealth);
                    //Debug.Log("Enemy life: " + enemy.life);
                    hitTimeEnemy = 0.0f;

                    if (enemy.currentHealth == 0)
                    {
                        enemy.isDead = true;
                        enemyAnimator.SetTrigger("death");
                        deathSound.Play();
                        Invoke("victory", 2.5f);
                    }
                }
                else
                {
                    if (enemyAnimator.GetCurrentAnimatorStateInfo(0).IsName("blocking") ||
                        enemyAnimator.GetCurrentAnimatorStateInfo(0).IsName("block"))
                    {
                        StartCoroutine(Part());
                    }
                }
            }
        }

        if (col.gameObject.tag == "Player" && hitTimePlayer >= 2)
        {
            PlayerActions player = col.gameObject.GetComponent <PlayerActions>();

            if (enemyAnimator.GetCurrentAnimatorStateInfo(0).IsName("espadazo") ||
                enemyAnimator.GetCurrentAnimatorStateInfo(0).IsName("espadazo_horizontal"))
            {
                //Debug.Log("Player life: " + player.life);
                if (!player.animator.GetCurrentAnimatorStateInfo(0).IsName("blocking") &&
                    !player.animator.GetCurrentAnimatorStateInfo(0).IsName("block"))
                {
                    player.currentHealth -= 1;
                    player.healthBar.setHealth(player.currentHealth);
                    //Debug.Log("Player life: " + player.life);
                    hitTimePlayer = 0.0f;

                    if (player.currentHealth == 0)
                    {
                        player.isDead = true;
                        player.animator.SetTrigger("death");
                        deathSound.Play();
                        Invoke("gameOver", 2.5f);
                    }
                }
                else
                {
                    if (player.animator.GetCurrentAnimatorStateInfo(0).IsName("blocking") ||
                        player.animator.GetCurrentAnimatorStateInfo(0).IsName("block"))
                    {
                        StartCoroutine(Part());
                    }
                }
            }
        }
    }
Example #40
0
 void Awake()
 {
     playerActions = GetComponent<PlayerActions>();
     audioFootStep = GetComponent<AudioSource>();
 }
Example #41
0
 private void Awake()
 {
     ///reference scripts, grabbing them through code instead of through inspector///
     Player_A = GameObject.Find("MainCamera").GetComponent <PlayerActions>();
 }
 private void Start()
 {
     playerActions = PlayerActions.CreateWithDefaultBindings();
     playerActions.Attack.WasPressedHandler  += OnPrepareAttack;
     playerActions.Attack.WasReleasedHandler += OnAttack;
 }
Example #43
0
 // Use this for initialization
 void Start()
 {
     player = GetComponent <PlayerActions>();
     boss   = GameObject.Find("Boss").GetComponent <BossIA>();
 }
 public void addTransition(PlayerActions newAction,PlayerStates newState)
 {
     transitions.Add(newAction,newState);
 }
        public static WeightedStat Stat(IPlayerActionManager manager, float weight, string subject, string obj)
        {
            IPlayerStatManager statManager = PlayerActions.StatManager(manager);

            return(new WeightedStat(statManager, 1, statManager.GetSummaryString));
        }
Example #46
0
 public Player(PlayerActions playerActions, PlayerResources playerResources)
 {
     this.PlayerActions   = playerActions;
     this.PlayerResources = playerResources;
 }
    IEnumerator ClearBuffer(float time)
    {
        yield return(new WaitForSecondsRealtime(time));

        nextAction = PlayerActions.None;
    }
 void Start()
 {
     actions = player.playerActions;
 }
Example #49
0
 public virtual bool HandlePlayerAction(Level level, PlayerActions playerAction) => false;
Example #50
0
 void OnEnable()
 {
     playerActions = PlayerActions.CreateWithDefaultBindings();
     LoadBindings();
 }
    // Token: 0x060019FB RID: 6651 RVA: 0x000893B8 File Offset: 0x000875B8
    public TeamEliminationRoom(GameRoomData gameData, GamePeer peer)
    {
        GameState.Current.MatchState.RegisterState(GameStateId.MatchRunning, new MatchRunningState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.PregameLoadout, new PregameLoadoutState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.PrepareNextRound, new PrepareNextRoundState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.EndOfMatch, new EndOfMatchState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.WaitingForPlayers, new WaitingForPlayersState(GameState.Current.MatchState));
        GameState.Current.MatchState.RegisterState(GameStateId.AfterRound, new AfterRoundState(GameState.Current.MatchState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Overview, new PlayerOverviewState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Playing, new PlayerPlayingState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.PrepareForMatch, new PlayerPrepareState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Killed, new PlayerKilledSpectatorState(GameState.Current.PlayerState, true));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Paused, new PlayerPausedState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.AfterRound, new PlayerAfterRoundState(GameState.Current.PlayerState));
        GameState.Current.PlayerState.RegisterState(PlayerStateId.Spectating, new PlayerSpectatingState(GameState.Current.PlayerState));
        GameState.Current.PlayerData.SendJumpUpdate     += base.Operations.SendJump;
        GameState.Current.PlayerData.SendMovementUpdate += base.Operations.SendUpdatePositionAndRotation;
        GameState.Current.RoomData                       = gameData;
        GameState.Current.Actions.ChangeTeam             = new Action(base.Operations.SendSwitchTeam);
        GameState.Current.Actions.IncreaseHealthAndArmor = delegate(int health, int armor)
        {
            base.Operations.SendIncreaseHealthAndArmor((byte)health, (byte)armor);
        };
        GameState.Current.Actions.RequestRespawn = new Action(base.Operations.SendRespawnRequest);
        GameState.Current.Actions.PickupPowerup  = delegate(int pickupID, PickupItemType type, int value)
        {
            base.Operations.SendPowerUpPicked(pickupID, (byte)type, (byte)value);
        };
        GameState.Current.Actions.OpenDoor       = new Action <int>(base.Operations.SendOpenDoor);
        GameState.Current.Actions.EmitQuickItem  = new Action <Vector3, Vector3, int, byte, int>(base.Operations.SendEmitQuickItem);
        GameState.Current.Actions.EmitProjectile = delegate(Vector3 origin, Vector3 direction, global::LoadoutSlotType slot, int projectileID, bool explode)
        {
            base.Operations.SendEmitProjectile(origin, direction, (byte)slot, projectileID, explode);
        };
        GameState.Current.Actions.RemoveProjectile = new Action <int, bool>(base.Operations.SendRemoveProjectile);
        GameState.Current.Actions.SingleBulletFire = new Action(base.Operations.SendSingleBulletFire);
        GameState.Current.Actions.KillPlayer       = delegate()
        {
            if (GameState.Current.IsInGame && GameState.Current.PlayerData.IsAlive)
            {
                base.Operations.SendDirectDeath();
            }
        };
        GameState.Current.Actions.DirectHitDamage = delegate(int targetCmid, ushort damage, BodyPart part, Vector3 force, byte slot, byte bullets)
        {
            base.Operations.SendDirectHitDamage(targetCmid, (byte)part, bullets, slot);
            if (PlayerDataManager.Cmid == targetCmid)
            {
                GameStateHelper.PlayerHit(targetCmid, damage, part, force);
            }
        };
        GameState.Current.Actions.ExplosionHitDamage = delegate(int targetCmid, ushort damage, Vector3 force, byte slot, byte distance)
        {
            base.Operations.SendExplosionDamage(targetCmid, slot, distance, force);
            if (PlayerDataManager.Cmid == targetCmid)
            {
                GameStateHelper.PlayerHit(targetCmid, damage, BodyPart.Body, force);
            }
        };
        GameState.Current.Actions.PlayerHitFeeback  = new Action <int, Vector3>(base.Operations.SendHitFeedback);
        GameState.Current.Actions.ActivateQuickItem = new Action <QuickItemLogic, int, int, bool>(base.Operations.SendActivateQuickItem);
        GameState.Current.Actions.JoinTeam          = delegate(TeamID team)
        {
            base.Operations.SendJoinGame(team);
            GameState.Current.MatchState.PopAllStates();
        };
        GameState.Current.Actions.JoinAsSpectator = delegate()
        {
            base.Operations.SendJoinAsSpectator();
            GameState.Current.MatchState.PopAllStates();
        };
        GameState.Current.Actions.KickPlayer  = new Action <int>(base.Operations.SendKickPlayer);
        GameState.Current.Actions.ChatMessage = new Action <string, byte>(base.Operations.SendChatMessage);
        GameState.Current.PlayerData.Actions.Clear();
        PlayerActions actions = GameState.Current.PlayerData.Actions;

        actions.UpdateKeyState = (Action <byte>)Delegate.Combine(actions.UpdateKeyState, new Action <byte>(peer.Operations.SendUpdateKeyState));
        PlayerActions actions2 = GameState.Current.PlayerData.Actions;

        actions2.SwitchWeapon = (Action <byte>)Delegate.Combine(actions2.SwitchWeapon, new Action <byte>(base.Operations.SendSwitchWeapon));
        PlayerActions actions3 = GameState.Current.PlayerData.Actions;

        actions3.UpdatePing = (Action <ushort>)Delegate.Combine(actions3.UpdatePing, new Action <ushort>(peer.Operations.SendUpdatePing));
        PlayerActions actions4 = GameState.Current.PlayerData.Actions;

        actions4.PausePlayer = (Action <bool>)Delegate.Combine(actions4.PausePlayer, new Action <bool>(base.Operations.SendIsPaused));
        PlayerActions actions5 = GameState.Current.PlayerData.Actions;

        actions5.SniperMode = (Action <bool>)Delegate.Combine(actions5.SniperMode, new Action <bool>(base.Operations.SendIsInSniperMode));
        PlayerActions actions6 = GameState.Current.PlayerData.Actions;

        actions6.AutomaticFire = (Action <bool>)Delegate.Combine(actions6.AutomaticFire, new Action <bool>(base.Operations.SendIsFiring));
        PlayerActions actions7 = GameState.Current.PlayerData.Actions;

        actions7.SetReadyForNextGame        = (Action <bool>)Delegate.Combine(actions7.SetReadyForNextGame, new Action <bool>(base.Operations.SendIsReadyForNextMatch));
        TabScreenPanelGUI.SortPlayersByRank = new Action <IEnumerable <GameActorInfo> >(GameStateHelper.SortTeamMatchPlayers);
        Singleton <QuickItemController> .Instance.IsConsumptionEnabled  = true;
        Singleton <QuickItemController> .Instance.Restriction.IsEnabled = true;
        Singleton <QuickItemController> .Instance.Restriction.RenewGameUses();

        AutoMonoBehaviour <UnityRuntime> .Instance.OnUpdate += this.OnUpdate;
        global::EventHandler.Global.AddListener <GlobalEvents.InputChanged>(new Action <GlobalEvents.InputChanged>(this.OnInputChangeEvent));
    }
Example #52
0
 public void addTransition(PlayerActions newAction, PlayerStates newState)
 {
     transitions.Add(newAction, newState);
 }
Example #53
0
    public void SetPlayerColorAndActions(PlayerColor playerColor, PlayerActions playerActions)
    {
        this.playerColor = playerColor;
        var energyBar = this.EnergyContainer.GetChild(0);
        energyBar.GetComponent<MeshRenderer>().material = this.EnergyMaterials[ (int) playerColor ];

        this.playerActions = playerActions;

        PlayerSkillType[] skills = PlayerManager.Instance.GetSkillsForColor(playerColor);
        for (int i = 0; i < skills.Length; i++)
        {
            var skill = (GameObject) Instantiate ( this.SkillsPrefabs[ (int) skills[i] ], this.transform.position, Quaternion.identity );
            skill.transform.localScale = Vector3.one;
            skill.transform.parent = this.transform;

            var playerSkill = skill.GetComponent<IPlayerSkill>();
            this.playerSkills.Add( playerActions.Skills[i], (IPlayerSkill) playerSkill);
        }
    }
Example #54
0
 private void Start()
 {
     statements = new Queue <Statement>();
     ClearAllText();
     playerActions = PlayerActions.CreateWithDefaultBindings();
 }
Example #55
0
	// Use this for initialization
	void Start () {
		input = PlayerActions.CreateWithDefaultBindings(PlayerIndex);
	}
Example #56
0
 private void Awake()
 {
     cameraActions = new PlayerActions();
     cameraActions.MoveAction.Look.performed += ctx => lookVal = ctx.ReadValue <Vector2>();
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerActions actions = gameObject.GetComponent <PlayerActions>();
        float         mapX    = GameObject.FindGameObjectWithTag("Ground").GetComponent <Renderer>().bounds.size.x;
        float         mapY    = GameObject.FindGameObjectWithTag("Ground").GetComponent <Renderer>().bounds.size.y;

        if (gameObject.name == "Player1_ItemLocation")
        {
            if (collision.tag == "Player 1")
            {
                GameObject pickedObject = GameObject.FindGameObjectWithTag("Player 1").GetComponent <PlayerActions>().pickedItem;
                bool       isRequired   = false;
                int        index        = 0;

                foreach (GameObject item in gameObject.GetComponent <HouseState>().itemsToLvl)
                {
                    if (pickedObject != null)
                    {
                        if (item.name + "(Clone)" == pickedObject.name)
                        {
                            index      = gameObject.GetComponent <HouseState>().itemsToLvl.IndexOf(item);
                            isRequired = true;
                            GameObject.Find("Item Manager").GetComponent <ItemRequired>().SpawnSlide1(mapX, mapY, 1);
                        }
                    }
                }

                if (isRequired)
                {
                    gameObject.GetComponent <HouseState>().itemsToLvl.RemoveAt(index);
                    GameObject.FindGameObjectWithTag("Player 1").GetComponent <PlayerActions>().pickedItem = null;
                    //actions.isPicked = false;
                    Destroy(pickedObject);
                    isRequired = false;
                }
            }
        }

        if (gameObject.name == "Player2_ItemLocation")
        {
            if (collision.tag == "Player 2")
            {
                GameObject pickedObject = GameObject.FindGameObjectWithTag("Player 2").GetComponent <PlayerActions>().pickedItem;
                bool       isRequired   = false;
                int        index        = 0;

                foreach (GameObject item in gameObject.GetComponent <HouseState>().itemsToLvl)
                {
                    if (pickedObject != null)
                    {
                        if (item.name + "(Clone)" == pickedObject.name)
                        {
                            index      = gameObject.GetComponent <HouseState>().itemsToLvl.IndexOf(item);
                            isRequired = true;
                            GameObject.Find("Item Manager").GetComponent <ItemRequired>().SpawnSlide2(mapX, mapY, 1);
                        }
                    }
                }

                if (isRequired)
                {
                    gameObject.GetComponent <HouseState>().itemsToLvl.RemoveAt(index);
                    GameObject.FindGameObjectWithTag("Player 2").GetComponent <PlayerActions>().pickedItem = null;
                    //actions.isPicked = false;
                    Destroy(pickedObject);
                    isRequired = false;
                }
            }
        }
    }
Example #58
0
 public new void Start()
 {
     playerActions = GetPlayerActions();
     GetPlayerEventListener().connect(this);
     animBody = GetComponent <Animator>();
 }
Example #59
0
        public override void Use(Player p, string message, CommandData data)
        {
            if (message.Length == 0)
            {
                Help(p); return;
            }

            bool preciseTP = message.CaselessStarts(precisePrefix);

            if (preciseTP)
            {
                message = message.Substring(precisePrefix.Length);
            }

            string[] args = message.SplitSpaces();
            if (args.Length >= 3)
            {
                TeleportCoords(p, args, preciseTP); return;
            }

            Player    target = null;
            PlayerBot bot    = null;

            if (args.Length == 1)
            {
                target = PlayerInfo.FindMatches(p, args[0]);
                if (target == null)
                {
                    return;
                }
                if (!CheckPlayer(p, target, data))
                {
                    return;
                }
            }
            else if (args[0].CaselessEq("bot"))
            {
                bot = Matcher.FindBots(p, args[1]);
                if (bot == null)
                {
                    return;
                }
            }
            else
            {
                Help(p);
                return;
            }

            SavePreTeleportState(p);
            Level lvl = bot != null ? bot.level : target.level;

            if (p.level != lvl)
            {
                PlayerActions.ChangeMap(p, lvl.name);
            }
            if (target != null && target.Loading)
            {
                p.Message("Waiting for " + target.ColoredName + " %Sto spawn..");
                target.BlockUntilLoad(10);
            }

            // Player wasn't able to join target map, so don't move
            if (p.level != lvl)
            {
                return;
            }

            Position    pos = bot != null ? bot.Pos : target.Pos;
            Orientation rot = bot != null ? bot.Rot : target.Rot;

            p.BlockUntilLoad(10); //Wait for player to spawn in new map
            p.SendPos(Entities.SelfID, pos, rot);
        }
 // Start is called before the first frame update
 void Start()
 {
     bh     = FindObjectOfType <BattleHandler>();
     player = FindObjectOfType <PlayerActions>();
 }