//protected float lag;
    //protected float lastNetworkDataRecievedTime;

    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        //lag = Mathf.Abs((float)(PhotonNetwork.time - info.timestamp));
        //lastNetworkDataRecievedTime = (float)info.timestamp;
        PMovement.SerializeState(stream, info);
        PController.SerializeState(stream, info);
    }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Beispiel #3
0
    void Reset()
    {
        Transform keyboardAndMouseCameraTransform = transform.Find("KeyboardAndMouseFreeLookRig");

        if (keyboardAndMouseCameraTransform != null)
        {
            keyboardAndMouseCamera = keyboardAndMouseCameraTransform.GetComponent <CinemachineFreeLook>();
        }

        Transform controllerCameraTransform = transform.Find("ControllerFreeLookRig");

        if (controllerCameraTransform != null)
        {
            controllerCamera = controllerCameraTransform.GetComponent <CinemachineFreeLook>();
        }

        PController playerController = FindObjectOfType <PController>();

        if (playerController != null && playerController.name == "Ellen")
        {
            follow = playerController.transform;

            lookAt = follow.Find("HeadTarget");

            if (playerController.cameraSettings == null)
            {
                playerController.cameraSettings = this;
            }
        }
    }
Beispiel #4
0
    // --------------------------------------------------------------

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PController playerController = other.gameObject.GetComponent <PController>();
            if (playerController)
            {
                // Kill the player
                playerController.Die();

                // Increase the score for the opposing player
                if (OnPlayerDeath != null)
                {
                    OnPlayerDeath(playerController.GetPlayerNum(false));
                }
            }
        }

        if (other.gameObject.tag == "Falling")
        {
            Falling fall = other.gameObject.GetComponent <Falling>();
            if (fall)
            {
                fall.Die();
            }
        }
    }
Beispiel #5
0
    // Called automatically by Unity when the script first exists in the scene.
    void Awake()
    {
        m_Input    = GetComponent <PInput>();
        m_Animator = GetComponent <Animator>();
        m_CharCtrl = GetComponent <CharacterController>();

        s_instance = this;
    }
Beispiel #6
0
 void Awake()
 {
     gameHUD       = (GameHUD)FindObjectOfType(typeof(GameHUD));
     selectObjects = (SelectObjects)FindObjectOfType(typeof(SelectObjects));
     gMode         = (GMode)FindObjectOfType(typeof(GMode));
     pController   = (PController)FindObjectOfType(typeof(PController));
     weaponPanel   = (WeaponPanel)FindObjectOfType(typeof(WeaponPanel));
     passivePanel  = (PassiveUnitPanel)FindObjectOfType(typeof(PassiveUnitPanel));
     units         = Unit.allUnits;
 }
 void Awake()
 {
     #region Singleton
     if (s_Instance != null)
     {
         Destroy(gameObject);
         return;
     }
     s_Instance = this;
     #endregion
 }
Beispiel #8
0
 void Awake()
 {
     gameHUD        = (GameHUD)FindObjectOfType(typeof(GameHUD));
     character      = (Character)FindObjectOfType(typeof(Character));
     selectObjects  = (SelectObjects)FindObjectOfType(typeof(SelectObjects));
     runUnitManager = (RunUnitManager)FindObjectOfType(typeof(RunUnitManager));
     gMode          = (GMode)FindObjectOfType(typeof(GMode));
     pController    = (PController)FindObjectOfType(typeof(PController));
     gameCommands.Add("Red");
     gameCommands.Add("Blue");
 }
    public void AddLaw()
    {
        LawEditor le = Instantiate(lawPrefab, container);

        le.path = this;
        laws.Add(le);
        le.ID = laws.IndexOf(le);
        ControllerEntity ce  = schemeObject.boardObject.GetComponent <ControllerEntity>();
        PController      con = (PController)ce.gameObject.AddComponent(typeof(PController));

        con.coefficient = 1;
        ce.laws.Add(con);
    }
Beispiel #10
0
 // When an enemy reaches the goal, deal damage to the player that let the enemy through
 public void PlayerDamage(short p)
 {
     if (p == 1)
     {
         PController x = InputManage.instance.leftPlayer.GetComponent <PController>();
         x.CmdPlayerDamage();
         x.TargetHealthUpdate(x.pHealth);
     }
     else
     {
         PController x = InputManage.instance.rightPlayer.GetComponent <PController>();
         x.CmdPlayerDamage();
         x.TargetHealthUpdate(x.pHealth);
     }
 }
Beispiel #11
0
 // When an enemy is defeated, give credits to the player it was sent to
 public void KillCredit(short p, short c)
 {
     if (p == 1)
     {
         PController x = p1.GetComponent <PController>();
         x.CreditTransaction(c);
         x.TargetCreditUpdate(x.credits);
     }
     else
     {
         PController x = p2.GetComponent <PController>();
         x.CreditTransaction(c);
         x.TargetCreditUpdate(x.credits);
     }
 }
Beispiel #12
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PController playerController = other.gameObject.GetComponent <PController>();
            if (playerController)
            {
                // Increase the score for player
                if (OnCollect != null)
                {
                    OnCollect(playerController.GetPlayerNum(true));
                }
            }
        }

        isActive = false;
        this.gameObject.GetComponent <Renderer>().enabled = false;
        this.gameObject.GetComponent <Collider>().enabled = false;
        RespawnTime = MAX_RESPAWN_TIME;
    }
Beispiel #13
0
        //*Class Constructor
        public SnmpConnect(string A, string B, int C)
        {
            Path = A; IP = B; port = C;

            try
            {
                VBforParamics.VBPconnect VBCon = new VBforParamics.VBPconnect();

                VBCon.ping(IP, port);
                PCont = VBCon.myPController;

                ConnectionStatus = PCont.GetStatus();
                if (ConnectionStatus == null)
                {
                    throw new Exception("Error: Cannot recover connection status, connection may not be established");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private void Start()
 {
     p_camera     = Camera.main;
     p_controller = GetComponent <PController>();
 }
Beispiel #15
0
 protected override void Awake()
 {
     base.Awake();
     Health.Set(CurrentHealth);
     controller = GetComponent <PController>();
 }
Beispiel #16
0
 public void setLookAt(Transform l)
 {
     lookAt      = l;
     pController = l.GetComponent <PController>();
 }