Exemplo n.º 1
0
    void OnEnable()
    {
        EditorGUI.BeginChangeCheck();


        CameraWork camWork = (CameraWork)target;

        camWork.camFollow = camWork.gameObject.GetComponent <CamFollow>();

        if (EditorGUI.EndChangeCheck())
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 2
0
    void StartCameraWork()
    {
        CameraWork cw = this.gameObject.GetComponent <CameraWork> ();

        if (cw == null)
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
            return;
        }

        if (PhotonNetwork.connected == false || photonView.isMine)
        {
            cw.StartFollowing(this.gameObject);
        }
    }
Exemplo n.º 3
0
        void Start()
        {
            CameraWork _canmeraWork = GetComponent <CameraWork>();

            if (_canmeraWork != null)
            {
                if (photonView.IsMine)
                {
                    _canmeraWork.OnStartFollowing();
                }
            }
            else
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
            }
        }
Exemplo n.º 4
0
    void Start()
    {
        if (!photonView.isMine)
        {
            return;
        }
        health.setBar(GameObject.Find("Healthbar").GetComponent <BarScript>());
        health.Initialize();
        mana.setBar(GameObject.Find("ManaBar").GetComponent <BarScript>());
        mana.Initialize();
        key.setBar(GameObject.Find("KeyBar").GetComponent <BarScript>());
        key.Initialize();

        audioSource  = GetComponent <AudioSource> ();
        playerCamera = Camera.main;
        cameraScript = playerCamera.GetComponent <CameraWork> ();
    }
Exemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        CameraWork camera = this.gameObject.GetComponent <CameraWork>();

        try
        {
            if (photonView.IsMine)
            {
                camera.OnStartFollowing();
            }
        }

        catch (Exception e)
        {
            Debug.Log(e.Message);
        }
    }
Exemplo n.º 6
0
        private void Start()
        {
            CameraWork _cameraWork = this.gameObject.GetComponent<CameraWork>();

            if (_cameraWork != null)
            {
                if (photonView.IsMine)
                {
                    _cameraWork.OnStartFollowing();
                }
            }
            else
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
            }

            // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded.
            UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
        }
        void Start()
        {
            CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();

            Debug.Assert(_cameraWork != null);
            if (photonView.IsMine)
            {
                _cameraWork.OnStartFollowing();
            }

            Debug.Assert(playerUiPrefab != null);
            GameObject _uiGo = Instantiate(playerUiPrefab);

            _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver);

            UnityEngine.SceneManagement.SceneManager.sceneLoaded += (scene, loadingMode) => {
                this.CalledOnLevelWasLoaded(scene.buildIndex);
            };
        }
Exemplo n.º 8
0
    void Start()
    {
        CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();


        if (_cameraWork != null)
        {
            if (photonView.isMine)
            {
                _cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
        }

        SceneManager.sceneLoaded += this.CalledOnLevelWasLoaded;
    }
Exemplo n.º 9
0
        /// <summary>
        /// MonoBehaviour method called on GameObject by Unity during initialization phase.
        /// </summary>
        void Start()
        {
            //CinemachineFreeLook _cinemachineFreeLook = this.gameObject.GetComponent<CinemachineFreeLook>();
            //
            //if (_cinemachineFreeLook != null)
            //{
            //    if (photonView.IsMine)
            //    {
            //        _cinemachineFreeLook.Follow = transform;
            //        _cinemachineFreeLook.LookAt = transform;
            //    }
            //}
            CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();


            if (_cameraWork != null)
            {
                if (photonView.IsMine)
                {
                    _cameraWork.OnStartFollowing();
                }
            }
            else
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
            }

#if UNITY_5_4_OR_NEWER
            // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded.
            UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
#endif

            if (PlayerUiPrefab != null)
            {
                GameObject _uiGo = Instantiate(PlayerUiPrefab);
                _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver);
            }
            else
            {
                Debug.LogWarning("<Color=Red><a>Missing</a></Color> PlayerUiPrefab reference on player Prefab.", this);
            }
        }
Exemplo n.º 10
0
    private void Start()
    {
        hp = 200;

        CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();


        if (_cameraWork != null)
        {
            if (photonView.isMine)
            {
                Game.Managers.GameManager.Instance.MatchController.PlayerController = this;
                _cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
        }
    }
Exemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        cameraWork = GetComponent <CameraWork>();

        panel = FindObjectOfType <Canvas>().transform.Find("GameOver Panel").gameObject;

        melee = transform.Find("Melee").gameObject;

        direction = new Vector3(0, 0, 1);
        //cooldowwnAnimator = GameObject.Find("SkillCooldowns").GetComponent<Animator>();
        cooldowwnAnimator = FindObjectOfType <Canvas>().transform.Find("Skill Panel").transform.Find("SkillCooldowns").GetComponent <Animator>();

        if (FindObjectOfType <PVPmode>())
        {
            gameModePVE             = false;
            cooldowwnAnimator.speed = 2f;
        }
        personalLight = transform.Find("Point light").gameObject;

        transform.Rotate(90, 0, 0);
    }
    /// <summary>
    /// Initialises the camera to this object if and only if this object belongs to the player.
    /// </summary>
    void CameraWork()
    {
        CameraWork _cameraWork = GetComponent <CameraWork>();

        if (_cameraWork != null)
        {
            if (photonView.IsMine || !PhotonNetwork.IsConnected)
            {
                GameObject.Find("Game Manager").GetComponent <GameMaster>().setPlayer(this.gameObject);
                _cameraWork.OnStartFollowing();
            }
            else
            {
                print("Photonview is not mine");
            }
        }
        else
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
        }
    }
Exemplo n.º 13
0
    void Start()
    {
        navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>(); //獲取自身AI组件
        animator     = GetComponent <Animator>();                    //動畫组件
        rb           = GetComponent <Rigidbody>();
        CameraWork _cameraWork =
            cam.gameObject.GetComponent <CameraWork>();

        if (_cameraWork != null)
        {
            if (photonView.IsMine)
            {
                _cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("playerPrefab- CameraWork component 遺失",
                           this);
        }
    }
    void Start()
    {
        if (photonView.IsMine)
        {
            rigidBody       = this.gameObject.GetComponent <Rigidbody2D>();
            sprites         = this.gameObject.GetComponentsInChildren <SpriteRenderer>();//gets all the player sprites
            currentGameMode = FindObjectOfType <GameMode>();
            if (currentGameMode)
            {
                currentGameMode.AddPlayer(this);
            }

            audioManager = FindObjectOfType <AudioManager>();
            foreach (SpriteRenderer sprite in sprites)
            {
                if (sprite.name == "GunBase")
                {
                    gun = sprite;
                }
            }
        }
        cameraWork = this.gameObject.GetComponent <CameraWork>();
        if (cameraWork != null)
        {
            if (photonView.IsMine)
            {
                cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("Camera Not Working");
        }
        //instantiates the mouse target
        if (MouseTarget)
        {
            mouseTarget    = Instantiate(MouseTarget, Camera.main.ScreenToWorldPoint(Input.mousePosition), new Quaternion(0, 0, 0, 0));
            Cursor.visible = false;
        }
    }
Exemplo n.º 15
0
    void Start()
    {
        if (photonView.IsMine == true && LocalPlayerInstance == this.gameObject)
        {
            panAndZoom = PanAndZoom.instance;

            panAndZoom.onSwipe += Control;
            CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();

            if (_cameraWork != null)
            {
                if (photonView.IsMine)
                {
                    _cameraWork.OnStartFollowing();
                }
            }
            else
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
            }
        }
    }
Exemplo n.º 16
0
    private void Start()
    {
        CameraWork cameraWork = this.gameObject.GetComponent <CameraWork>();

        if (cameraWork != null)
        {
            if (photonView.IsMine)
            {
                cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
        }
#if UNITY_5_4_OR_NEWER
        // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded.
        UnityEngine.SceneManagement.SceneManager.sceneLoaded += (scene, loadingMode) =>
        {
            this.CalledOnLevelWasLoaded(scene.buildIndex);
        };
#endif
    }
Exemplo n.º 17
0
    /// <summary>
    /// 初期化の際にUnityによりGameObjectに呼び出されるMonoBehaviourメソッド
    /// </summary>
    void Start()
    {
        if (playerUiPrefab != null)
        {
            GameObject _uiGo = Instantiate(playerUiPrefab);
            _uiGo.SendMessage("SetTarget", this, SendMessageOptions.RequireReceiver);
        }
        else
        {
            Debug.LogWarning("<Color=Red><a>Missing</a></Color> PlayerUiPrefab reference on player Prefab.", this);
        }


        CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();


        if (_cameraWork != null)
        {
            if (photonView.IsMine)
            {
                _cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
        }

        #if UNITY_5_4_OR_NEWER
        // Unity 5.4 has a new scene management. register a method to call CalledOnLevelWasLoaded.
        UnityEngine.SceneManagement.SceneManager.sceneLoaded += (scene, loadingMode) =>
        {
            this.CalledOnLevelWasLoaded(scene.buildIndex);
        };
        #endif
    }
Exemplo n.º 18
0
 void Start()
 {
     playerCamera = Camera.main;
     cameraScript = playerCamera.GetComponent <CameraWork>();
 }
 private void Awake()
 {
     this._characterController = GetComponent <CharacterController>();
     this._cameraWork          = GetComponent <CameraWork>();
     this._animator            = GetComponent <Animator>();
 }
Exemplo n.º 20
0
    void Start()
    {
        if (PhotonNetwork.IsMasterClient)
        {
            cameraRotation = 225f;
        }
        //Special Skills

        //Generic
        specialCoolDown   = false;
        channelingSpecial = false;
        dashCoolDown      = false;

        //Skeleton
        if (faction == 0)
        {
            skeletonBonus         = false;
            skeletonHealAmount    = 20;
            skeletonBonusToDamage = 3;
        }

        //Sorceress
        if (faction == 1)
        {
            sorceressTargeting           = false;
            fireBallTargetCircle         = gameObject.transform.GetChild(4).GetComponent <MeshRenderer>();
            fireBallTargetComponent      = gameObject.transform.GetChild(4);
            fireBallTargetCircle.enabled = false;
        }


        //Angel
        if (faction == 2)
        {
            channelingSphereParticle = gameObject.transform.GetChild(5).GetComponent <ParticleSystem>();
            channelingSphereOn       = false;
        }

        dashing = false;

        rb       = GetComponent <Rigidbody>();
        ac       = GetComponent <Animator>();
        joystick = FindObjectOfType <Joystick>();
        CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>();

        minAttackDistance = .5f;
        canAttack         = true;
        hasTarget         = false;

        level = 0;
        LevelUp();
        xp = 0;



        if (_cameraWork != null)
        {
            if (photonView.IsMine)
            {
                _cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this);
        }
    }
Exemplo n.º 21
0
 void Start()
 {
     _camWorkScr = _camWorkObject.GetComponent <CameraWork>();
 }
Exemplo n.º 22
0
 void Start()
 {
     cameraObj     = GameObject.Find("Main Camera");
     camera_Script = cameraObj.GetComponent <CameraWork>();
     myName        = gameObject.name;
 }