예제 #1
0
    void Start()
    {
        //	PlayerPrefs.DeleteKey("tutorial");

        this.slowJump = true;
        // Se o tutorial ja estiver completo
        if (SaveSystem.loadString("tutorial") == "tutorial")
        {
            jump = GameObject.Find("JumpTutorial");
            Destroy(jump);
            Destroy(prefabsJump.GetComponent <ActiveJumpDinoTutorial>());
            Destroy(gameObject);
        }

        else
        {
            // Get Components
            touch     = GameObject.Find("DirTouch").GetComponent <TouchRight>();
            touchLeft = GameObject.Find("EsqTouch").GetComponent <TouchLeft>();
            jump      = GameObject.Find("JumpTutorial");
            jump.SetActive(false);
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        //hierarchyObjects = GameObject.FindGameObjectWithTag("Respawn");

        if (isServer || isLocalPlayer)
        {
            if (isLocalPlayer)
            {
                // Inform the local player about his new character
                var localSingleton = LocalPlayerController.Singleton;
                // if (localSingleton != null)
                {
                    localSingleton.SetActor(this);
                    CmdInitialize(prefabName);
                    wantsAuthority = false;
                }
            }

            //this part is for object sharing
            //*******************************
            // actually both want the list of distributed items
            GameObject[] obs = GameObject.FindGameObjectsWithTag("shared");
            sharedObjects = new List <NetworkIdentity>();

            foreach (GameObject o in obs)
            {
                sharedObjects.Add(o.GetComponent <NetworkIdentity>());
                //  NetworkServer.Spawn(o);
            }

            if (isServer)
            {
                // find objects that can be manipulated
                // TIPP : you can use a specific tag for all GO's that can be manipulated by players
            }
            if (isLocalPlayer)
            {
                // find objects that can be manipulated
                // assign this Actor to the localActor field of the AuthorityManager component of each shared object
                if (obs == null)
                {
                    obs = GameObject.FindGameObjectsWithTag("shared");
                }
                {
                    foreach (GameObject o in obs)
                    {
                        o.GetComponent <AuthorityManager>().AssignActor(this);
                    }
                }

                var timerObj = GameObject.FindGameObjectWithTag("Timer");
                timerText  = timerObj.GetComponentInChildren <Text>();
                timer      = timerObj.GetComponentInChildren <Timer>();
                pointsText = GameObject.FindGameObjectWithTag("Points").GetComponentInChildren <Text>();
            }
            //*******************************
        }
        else
        {
            // Initialize on startup
            Initialize(prefabName);
        }
        playerTag = GameObject.FindGameObjectWithTag("Player");

        // include inactive children, as the capsule hands are only set active
        // if Leap rexognizes your hands
        tr = playerTag.GetComponentInChildren <TouchRight>(true);
        tl = playerTag.GetComponentInChildren <TouchLeft>(true);
        //createObjects = gameObject.GetComponentInChildren<CreateManipObj>();
    }
예제 #3
0
    /* Lorsqu'on appuie à DROITE de l'écran, le joueur peut :
     * - si un ennemi est là		TIRER
     * - si aucun ennemi n'est là	SAUTER | VOLER
     */
    private void PlayerActionRight(TouchRight touch)
    {
        if (!activateTouch)
            return;

        // Si un ennemi est présent, on ne peut sauter qu'à gauche de l'écran
        if (LevelManager.levelManager.GetEnemyEnCours () != null)
            return;

        if (!IsFlying ())
            JumpController ();
        else {
            if (wantToFly)
                return;

            wantToFly = true;

            flyingTouchId = touch.rightId;
            flyingTouchPosition = touch.rightTouchPosition;
        }
    }
예제 #4
0
 private void ShootController(TouchRight touch)
 {
     if (currentWeaponFireRate == 0 || !isMachineGun) {
         // On attend une frame pour que WeaponRotation.cs ait le temps de se mettre en place
         Invoke ("Shoot", TimeManager.deltaTime);
     } else {
         wantToShoot = true;
         shootingId = touch.rightId;
     }
 }
예제 #5
0
 void Start()
 {
     this.interfaceJumba = GetComponent <InterfaceJumba>();
     right = GameObject.Find("DirTouch").GetComponent <TouchRight>();
     left  = GameObject.Find("EsqTouch").GetComponent <TouchLeft>();
 }