Example #1
0
 // Use this for initialization
 void Start()
 {
     input = PlayerTarget.GetComponent<PlayerInputController>();
     machine = PlayerTarget.GetComponent<PlayerMachine>();
     controller = PlayerTarget.GetComponent<SuperCharacterController>();
     target = PlayerTarget.transform;
 }
 public static void Simulate(PlayerMachine machine, bool toggle)
 {
     if (toggle)
     {
         StatMaster.Instance.StartCoroutine(IESimulate(machine));
     }
     else
     {
         if (MirrorMachines.ContainsKey(machine))
         {
             if (machine.InternalObject)
             {
                 foreach (var block in MirrorMachines[machine])
                 {
                     if (!block)
                     {
                         continue;
                     }
                     foreach (var col in block.cols)
                     {
                         IgnoreAllBlocksInMachine(col, machine.InternalObject, false);
                     }
                 }
             }
             MirrorMachines.Remove(machine);
         }
         if (MirrorParents.ContainsKey(machine))
         {
             GameObject.Destroy(MirrorParents[machine].gameObject);
             MirrorParents.Remove(machine);
         }
     }
 }
Example #3
0
 void Awake()
 {
     if (playerMachine == null)
     {
         playerMachine = GetComponent <PlayerMachine>();
     }
 }
Example #4
0
        public void ToggleState(bool enabled, PlayerMachine playerMachine)
        {
            _enabled       = enabled;
            PlayerMachine  = null;
            bossController = null;

            // Search for Boss
            var go = GameObject.Find("Boss Room");

            if (_enabled)
            {
                PlayerMachine = playerMachine;
                BuildDialogueCache();

                tvRadiusCache.ClearCache();
                talkVolumeRenderFlag = false;
                tvRadiusCache.UpdateCache(TalkVolumeCreator, talkVolumeRenderFlag);

                collPlaneCache.ClearCache();
                collisionRenderFlag = false;
                collPlaneCache.UpdateCache(VoidOutCreator, collisionRenderFlag);

                camEventsFound = FindObjectsOfType <HiddenPlatform>().Length > 0;

                if (go)
                {
                    bossController = go.GetComponent <BossRoomController>().Boss;
                }
            }
        }
Example #5
0
 private void resultBubbleClose()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMachine>();
     player.setCutsceneMode(false);
     player.setFrozenStatus(false);
     StartCoroutine(waitBeforeEnablingJump());
 }
Example #6
0
    public void Play200FourPlayerGames()
    {
        for (int i = 0; i < 200; i++)
        {
            Administrator a = new Administrator();
            Board         b = new Board(new Vector2Int(6, 6), true);
            a.SetBoard(b);
            PlayerMachine pm = new PlayerMachine("testPlayer1");
            a.AddNewPlayer(pm);
            PlayerMachine pm2 = new PlayerMachine("testPlayer2");
            pm2.AIType = PlayerAIType.ASYMMETRIC;
            a.AddNewPlayer(pm2);
            PlayerMachine pm3 = new PlayerMachine("testPlayer3");
            pm3.AIType = PlayerAIType.SYMMETRIC;
            a.AddNewPlayer(pm3);
            PlayerMachine pm4 = new PlayerMachine("testPlayer4");
            a.AddNewPlayer(pm4);

            a.InitializeGame();

            a.Play();
            Assert.IsTrue((b.CurrentPlayersIn.Count == 1 && b.CurrentPlayersOut.Count == 3) ||
                          (b.CurrentPlayersIn.Count == 0 && b.CurrentPlayersOut.Count == 4), "Valid win conditions");
        }
    }
Example #7
0
 public void OnGUI()
 {
     if (StatMaster.SimulationState >= SimulationState.GlobalSimulation || StatMaster.inMenu || StatMaster.isMainMenu || (StatMaster.SimulationState == SimulationState.SpectatorMode && StatMaster.isMP))
     {
         return;
     }
     if (hudToggle)
     {
         foreach (var kvp in this.restrictedBlocksDic)
         {
             kvp.Value.currentCount      = 0;
             kvp.Value.highestPowerValue = 0;
         }
         this.weakPointCount = 0;
         if (StatMaster.isMP)
         {
             LJTMachine.MachineDic[PlayerMachine.GetLocal()].HasCompliance = this.hasCompliance;
         }
         this.windowRect = GUILayout.Window(32575339, this.windowRect, new GUI.WindowFunction(this.MainWindow), LocalisationFile.GetTranslatedString("Title"));
         if (this.uf)
         {
             this.windowRect2 = GUILayout.Window(32575340, this.windowRect2, new GUI.WindowFunction(this.UsageAndFunction), LocalisationFile.GetTranslatedString("UF"));
         }
         if (this.playerStats)
         {
             this.windowRect3 = GUILayout.Window(32575341, this.windowRect3, new GUI.WindowFunction(this.StatusWindow), LocalisationFile.GetTranslatedString("PlayerStats"));
         }
     }
 }
Example #8
0
 void Start()
 {
     _colorChanger  = GetComponent <ColorChanger>();
     _playerMachine = GetComponent <PlayerMachine>();
     _currentColor  = _baseColor;
     ChangeColor(_baseColor);
 }
Example #9
0
 void Start()
 {
     input      = PlayerTarget.GetComponent <PlayerInputController>();
     machine    = PlayerTarget.GetComponent <PlayerMachine>();
     controller = PlayerTarget.GetComponent <SuperCharacterController>();
     target     = PlayerTarget.transform;
 }
Example #10
0
    public void KickPlayerReplaceAI(PlayerAIType aitype = PlayerAIType.RANDOM)
    {
        PlayerMachine pm = new PlayerMachine(MyPlayer.GetName());

        pm.AIType = aitype;
        MyPlayer  = pm;
    }
Example #11
0
 private void DisplayRemainingRocketCount()
 {
     if (!DisplayRocketCount)
     {
         return;
     }
     if (cameraController == null)
     {
         return;
     }
     if (cameraController.activeCamera == null)
     {
         return;
     }
     if (cameraController.activeCamera.CamMode == FixedCameraBlock.Mode.FirstPerson)
     {
         if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out groupedRockets))
         {
             string textString = "";
             foreach (var group in groupedRockets)
             {
                 textString += KeyCodeConverter.GetKey(group.Key).ToString() + ": " + group.Value.Count + Environment.NewLine;
             }
             GUI.Box(counterRect, LanguageManager.Instance.CurrentLanguage.RemainingRockets + Environment.NewLine + textString, groupedRocketsCounterStyle);
         }
     }
 }
Example #12
0
 void Start()
 {
     gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();
     uiParent    = gameManager.uiParent;
     player      = gameManager.playerMachine;
     animator    = gameObject.GetComponent <Animator>();
 }
 void Awake()
 {
     if (playerMachine == null)
     {
         playerMachine = GetComponent<PlayerMachine>();
     }
 }
Example #14
0
 void Start()
 {
     if (StatMaster.levelSimulating && (!StatMaster.isClient || StatMaster.isLocalSim))
     {
         if (StatMaster.isMP)
         {
             if (LJTMachine.MachineDic.TryGetValue(PlayerMachine.From(this.transform.parent.parent.gameObject), out LJTMachine ljtMachine))
             {
                 if (ljtMachine.TankTypeInt == 5)
                 {
                     return;
                 }
                 this.joint        = this.GetComponent <Joint>();
                 joint.breakForce  = 20000f;
                 joint.breakTorque = 20000f;
             }
         }
         else
         {
             if (MachineInspector.Instance.isJunkTank)
             {
                 return;
             }
             this.joint        = this.GetComponent <Joint>();
             joint.breakForce  = 20000f;
             joint.breakTorque = 20000f;
         }
     }
 }
Example #15
0
        void AddTankTypeMenu(Block block)
        {
            MMenu tankTypeMenu = block.InternalObject.AddMenu(new MMenu("tankTypeMenu", 5, Enum.GetNames(typeof(TankType)).ToList(), false));

            tankTypeMenu.ValueChanged += tankTypeInt =>
            {
                if (!StatMaster.levelSimulating)
                {
                    if (block.Machine == PlayerMachine.GetLocal())
                    {
                        MachineInspector.Instance.SetTankType((TankType)tankTypeInt);
                        StartCoroutine(this.SetTankTypeCoroutine(block.Machine, tankTypeInt));
                    }
                }
            };
            MachineInspector.Instance.OnTypeChangeFromGUI += x =>
            {
                if (block.Machine == PlayerMachine.GetLocal())
                {
                    tankTypeMenu.SetValue(x);
                    tankTypeMenu.ApplyValue();
                    block.InternalObject.OnSave(new XDataHolder());
                }
            };
        }
Example #16
0
 void Awake()
 {
     if (this.isWeakPoint && StatMaster.isMP)
     {
         LJTMachine.MachineDic.TryGetValue(PlayerMachine.From(this.transform.parent.parent.gameObject), out LJTMachine lJTMachine);
         lJTMachine.WeakPointObject = this.gameObject;
     }
 }
 public override void Init()
 {
     base.Init();
     machine            = GetComponent <PlayerMachine>();
     collectablesAmount = 0;
     inmunity           = false;
     machine.ChangeState("PlayerIdleState");
 }
 // Use this for initialization
 void Start()
 {
     if(m_playerTarget != null)
     {
         input = m_playerTarget.GetComponent<PlayerInputController>();
         machine = m_playerTarget.GetComponent<PlayerMachine>();
         controller = m_playerTarget.GetComponent<SuperCharacterController>();
     }
 }
        public static IEnumerator IESimulate(PlayerMachine machine)
        {
            yield return(new WaitForEndOfFrame());

            if (Portal.displayMirrors)
            {
                CreateMirrorMachine(machine);
            }
        }
Example #20
0
 public void ReachedFinishLine(PlayerMachine.PlayerIdentifier player)
 {
     if (Winners.Contains(player)) return;
     Winners.Add(player);
     if (Winners.Count == PlayerCount) {
         // all winners are assigned, so game is over
         EveryoneFinished();
     }
 }
Example #21
0
        IEnumerator SetTankTypeCoroutine(PlayerMachine playerMachine, int tankTypeInt)
        {
            yield return(null);

            if (LJTMachine.MachineDic.TryGetValue(playerMachine, out LJTMachine ljtMachine))
            {
                ljtMachine.TankTypeInt = tankTypeInt;
            }
        }
Example #22
0
 public override void Start(PlayerMachine machine)
 {
     KeyInputController = machine.InternalObject.GetComponent <KeyInputController>();
     foreach (var block in machine.SimulationBlocks)
     {
         NameIndex.Add(block, block.Prefab.Name);
         GuidIndex.Add(block, block.Guid.ToString());
         ClassNameIndex.Add(block, BlockWrapper.GetClassNames(block));
     }
 }
Example #23
0
    void Awake()
    {
        isPageFinished = true;
        speed          = defaultSpeed;
        animator       = GetComponent <Animator>();
        StartCoroutine(PlayInAnimation());

        player       = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMachine>();
        inputManager = GameObject.FindGameObjectWithTag("InputManager").GetComponent <custom_inputs>();
    }
Example #24
0
 private float GetBlowingSpeedModifier(PlayerMachine pm)
 {
     const float blowingEffectPercentage = 0.64f;
     const float blowingFactor = 3.4f;
     //const float fearThreshold = 0.85f;
     //return pm.CurrentBreathPressure > fearThreshold
     //    ? (BASE_SPEED*blowingEffectPercentage)*-1
     //    : BASE_SPEED*blowingEffectPercentage*blowingFactor*pm.CurrentBreathPressure;
     return BASE_SPEED*blowingEffectPercentage*blowingFactor*pm.CurrentBreathPressure;
 }
Example #25
0
 public void OnEarlyUpdate(PlayerMachine playerMachine)
 {
     if (PlayerMachine.CurrentCostume == Costumes.Fast)
     {
         playerMachine.FrictionMult = 0.5f;
     }
     else
     {
         playerMachine.FrictionMult = 1;
     }
 }
    public void Enter()
    {
        result                   = null;
        playerMachine            = new PlayerMachine();
        playerMachine.playerData = new PlayerMachine.Data();

        playerMachine.ChangeState(new IPS_Move());
        var gui = UnityEngine.Object.FindObjectOfType <GUIControll>();

        gui.GUIEnabled.mission.Player.SetActive(true);
    }
Example #27
0
    public void swingHammer()
    {
        alreadyHit     = false;
        playerMachine  = gameManager.playerMachine;
        playerAnimator = gameManager.playerAnimator;

        playerMachine.hammering = true;
        playerMachine.art.hammerSwing();
        playerMachine.art.animator.SetFloat("Hammer", 1);
        playerMachine.allowMovement = false;
    }
Example #28
0
    // Use this for initialization
    void Start()
    {
        Administrator a = new Administrator();
        Board         b = new Board(new Vector2Int(6, 6));

        a.SetBoard(b);
        foreach (string s in PlayerNames)
        {
            PlayerMachine p = new PlayerMachine(s);
            a.AddNewPlayer(p);
        }
    }
Example #29
0
    public void PlacePawnTest()
    {
        Board         b  = new Board(new Vector2Int(6, 6));
        PlayerMachine pm = new PlayerMachine("pete");

        //Run 200 tests to ensure it is always on an edge position
        for (int i = 0; i < 200; i++)
        {
            PlayerLocation pl = pm.PlacePawn(b);
            Assert.IsTrue(pl.IsEdgePosition(b.BoardSize), "Is correct edge position");
        }
    }
Example #30
0
    public void SymmetryScoresTest()
    {
        PlayerMachine pm        = new PlayerMachine("pete");
        List <Tile>   testTiles = TestTile.GenerateTiles();

        Assert.AreEqual(4, pm.UniqueRotationTiles(testTiles [0]), "No rotational symmetry detected");
        Assert.AreEqual(4, pm.UniqueRotationTiles(testTiles [1]), "No rotational symmetry detected");
        Assert.AreEqual(4, pm.UniqueRotationTiles(testTiles [2]), "No rotational symmetry detected");
        Assert.AreEqual(4, pm.UniqueRotationTiles(testTiles [3]), "No rotational symmetry detected");
        Assert.AreEqual(1, pm.UniqueRotationTiles(testTiles [4]), "Two of three other paths are symmetrical to first path");
        Assert.AreEqual(1, pm.UniqueRotationTiles(testTiles [5]), "All paths are symmetrical to each other");
        Assert.AreEqual(2, pm.UniqueRotationTiles(testTiles [6]), "All paths are symmetrical to each other");
    }
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            player = other.gameObject.GetComponent <PlayerMachine>();

            player.gameManager.GetBackpack().items.Add(itemType);
            ItemPopup popup = Instantiate(itemPopup, player.gameManager.uiParent.transform).GetComponent <ItemPopup>();
            player.audioSource.PlayOneShot(collectSound);
            player.art.animator.SetBool("ItemGet", true);
            popup.StartPopup(itemType, player);
            Destroy(gameObject);
        }
    }
Example #32
0
 public void UpdateRocketFiredStatus(TimedRocket rocket)
 {
     if (playerGroupedRockets.TryGetValue(StatMaster.isMP ? PlayerMachine.GetLocal().Player.NetworkId : 0, out Dictionary <KeyCode, HashSet <TimedRocket> > groupedRockets))
     {
         RocketScript rocketScript = rocket.GetComponent <RocketScript>();
         if (rocketScript != null)
         {
             if (groupedRockets.TryGetValue(rocketScript.GroupFireKey.GetKey(0), out HashSet <TimedRocket> rockets))
             {
                 rockets.Remove(rocket);
             }
         }
     }
 }
Example #33
0
    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player") && !isTurning)
        {
            playerObject  = other.transform;
            player        = playerObject.GetComponent <PlayerMachine>();
            camera        = player.gameManager.mainCamera.GetComponent <CameraController>();
            input         = player.gameManager.playerGamepad;
            startRotation = playerObject.rotation.eulerAngles;

            isTurning = true;
            StartCoroutine(TurnPlayer(targetRotation, false));
        }
    }
Example #34
0
    void Start()
    {
        player = GameControl.instance.player;

        input = player.GetComponent<PlayerInputController>();
        machine = player.GetComponent<PlayerMachine>();
        controller = player.GetComponent<SuperCharacterController>();
        target = player.transform;

        // Set the look direction based on the initial rotation of the player
        lookDirection = Quaternion.AngleAxis(machine.InitialRotation, controller.up) * Vector3.forward;

        distance = (minDistance + maxDistance) / 2;
    }
Example #35
0
    public void ChooseAsymmetricTest()
    {
        Board         b  = new Board(new Vector2Int(6, 6));
        PlayerMachine pm = new PlayerMachine("pete");

        pm.AIType = PlayerAIType.ASYMMETRIC;
        List <Tile> testTiles = TestTile.GenerateTiles();
        Hand        h         = new Hand();

        h.AddToHand(testTiles [0]);
        h.AddToHand(testTiles [4]);
        h.AddToHand(testTiles [5]);
        Assert.AreEqual(testTiles[0], pm.PlayTurn(b, h.Pieces, b.CurrentDeck.Pieces.Count));
    }
Example #36
0
    // Use this for initialization
    void Start()
    {
        if( Instance == null ){
            Instance = this;
        }else if( Instance != null ){
            Destroy(this);
        }

        input = PlayerTarget.GetComponent<PlayerInputController>();
        machine = PlayerTarget.GetComponent<PlayerMachine>();
        controller = PlayerTarget.GetComponent<SuperCharacterController>();
        target = PlayerTarget.transform;
        onSpin = false;
        continueRotation = 1.0f;
    }
Example #37
0
    void OnEnable()
    {
        if (optionObjects.Count > 0)
        {
            if (!keepSelectedIndex)
            {
                selectedIndex         = 0;
                previousSelectedIndex = 0;
            }
        }
        else
        {
            Debug.LogWarning("A cursor without at least one valid option was enabled! Disabling!");
            gameObject.SetActive(false);
        }
        PlayerMachine player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMachine>();

        audioSource  = player.audioSource;
        inputManager = player.gameManager.inputManager;

        options = new List <ISelectable>();
        foreach (GameObject obj in optionObjects)
        {
            ISelectable option = obj.GetComponent <ISelectable>();
            options.Add(option);
            option.OnCursorInit(this);
        }

        targetPosition = options[selectedIndex].GetGrabPoint();

        if (enableStartAnimation)
        {
            if (startPosition == Vector3.zero)
            {
                startPosition = transform.position;
            }
            transform.position = startPosition;
        }
        else
        {
            transform.position = targetPosition;
        }

        options[selectedIndex].OnCursorSelect();

        active = true;
    }
 protected override void TransitionIntoState(PlayerMachine player)
 {
     player.CurrentRawBreathPressure =
         Mathf.Clamp(player.CurrentRawBreathPressure + (additionalBlowValue*Time.deltaTime), 0,
             MaxIntensity);
 }
 public void ChangePlayerState(PlayerMachine player, PlayerStates desiredState)
 {
     if (desiredState == State) return;
     TransitionOutOfState(player);
     TransitionIntoState(player);
     player.CurrentPlayerState = StateLookup[desiredState];
 }
 public override void Act(PlayerMachine player)
 {
     // they're holding down the button ...
     player.CurrentLungCapacity =
         Mathf.Clamp(player.CurrentLungCapacity - (blowVolumeUse*player.CurrentBreathPressure*Time.deltaTime), 0,
             MaxLungCapacity);
 }
    void Start()
    {
        Origin = transform.GetChild(1);
        Torso = Origin.GetChild(2);
        HipLeft = Origin.GetChild(0);
        HipRight = Origin.GetChild(1);
        Head = Torso.GetChild(0);
        ShoulderLeft = Torso.GetChild(1);
        ShoulderRight = Torso.GetChild(2);
        ElbowLeft = ShoulderLeft.GetChild(0);
        HandLeft = ElbowLeft.GetChild(0);
        ElbowRight = ShoulderRight.GetChild(0);
        HandRight = ElbowRight.GetChild(0);
        KneeLeft = HipLeft.GetChild(0);
        FootLeft = KneeLeft.GetChild(0);
        KneeRight = HipRight.GetChild(0);
        FootRight = KneeRight.GetChild(0);

        machine = gameObject.GetComponent<PlayerMachine>();

        SetAnimIdentity( Identity );
        SetMoveAnim ( Run , 0f );
    }
 public override void Act(PlayerMachine player)
 {
     player.CurrentRawBreathPressure = Mathf.Clamp(
         player.CurrentRawBreathPressure - (percentageReducedWhileResting*Time.deltaTime), 0,
         MaxIntensity);
     player.CurrentLungCapacity =
         Mathf.Clamp(player.CurrentLungCapacity + (RateOfBreathReplenishment*Time.deltaTime), 0,
             MaxLungCapacity);
 }
 public virtual void Act(PlayerMachine player)
 {
 }
 protected virtual void TransitionIntoState(PlayerMachine player)
 {
 }
 protected virtual void TransitionOutOfState(PlayerMachine player)
 {
 }