Esempio n. 1
0
 private void Start()
 {
     if (gameEndPanel != null)
     {
         gameEndPanel.SetActive(false);
     }
     myTimer = GetComponent <ControllerBehaviour>();
 }
 /**
  * Attaches the plane to the controller's position and shows it
  */
 public void Show(ControllerBehaviour controller)
 {
     transform.position       = controller.transform.position;
     transform.rotation       = controller.transform.rotation;
     transform.parent         = controller.transform;
     transform.localPosition += new Vector3(0, 0, 1.05f);
     gameObject.SetActive(true);
 }
Esempio n. 3
0
    public void Start()
    {
        playerStats = GetComponentInParent <PlayerGameplayValues>();

        controllerBehaviour = transform.parent.GetComponent <ControllerBehaviour>();
        healthBehaviour     = transform.parent.GetComponent <HealthBehaviour>();
        bowController       = transform.parent.GetComponent <BowController>();
    }
Esempio n. 4
0
 void Start()
 {
     listReference = GameObject.FindGameObjectWithTag("Spawner").GetComponent <ControllerBehaviour>();
     myRend        = GetComponent <MeshRenderer>();
     SetPlayerColor();
     curLives = maxLives;
     myRB     = GetComponent <Rigidbody>();
 }
Esempio n. 5
0
 void Start()
 {
     shipListController = GetComponent <ControllerBehaviour>();
     playerConnect      = new bool[4];
     for (int i = 0; i < playerConnect.Length; i++)
     {
         playerConnect[i] = false;
     }
 }
Esempio n. 6
0
    /// <summary>
    /// Facebook player basic infos callback. Being the first login is added to coins the gift for logged in.
    /// At last is call the ScoreAndKDCallback callback.
    /// </summary>
    /// <param name="result">Result.</param>
    void PlayerInfoCallback(IResult result)
    {
        if (result.Error != null)
        {
            _facebookPlayersObserver.OnError();
        }
        else
        {
            string id        = result.ResultDictionary["id"].ToString();
            string name      = result.ResultDictionary["name"].ToString();
            int    highscore = 0;
            Coins  coins     = LoadCoins();

            if (result.ResultDictionary.ContainsKey("scores"))
            {
                IDictionary <string, object> data = (IDictionary <string, object>)result.ResultDictionary ["scores"];
                List <object> listObj             = (List <object>)data ["data"];

                foreach (object obj in listObj)
                {
                    var entry = (Dictionary <string, object>)obj;

                    if (entry ["score"] != null)
                    {
                        highscore = Int32.Parse(entry ["score"].ToString());
                    }

                    break;
                }
            }
            else
            {
                coins.SetFacebookGift();
            }

            if (_localPlayer._highScore > highscore)
            {
                highscore = _localPlayer._highScore;
                SaveNewHighScore(highscore);
            }

            _localPlayer = new Player(id, name, highscore, coins);

            //Notifies the server that the player has changed id
            foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Player"))
            {
                ControllerBehaviour player = obj.GetComponent <ControllerBehaviour> ();
                if (player.isLocalPlayer)
                {
                    player.ChangedId();
                    break;
                }
            }

            FB.API("/app/scores?fields=score,user.limit(30)", HttpMethod.GET, ScoreAndKDCallback);
        }
    }
Esempio n. 7
0
    public void Start()
    {
        playerStats = GetComponent <PlayerGameplayValues>();

        timeBetweenShots    = data.timeBetweenShots;
        controllerBehaviour = GetComponent <ControllerBehaviour>();

        StartCoroutine(GiveArrows());
    }
    /**
     * Begin interaction with a controller
     */
    public void OnBeginInteraction(ControllerBehaviour controller)
    {
        // Save reference to controller
        attachedController = controller;

        // Follow controller's position and orientation
        this.transform.parent = controller.transform;

        interacting = true;
    }
Esempio n. 9
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent <PlayerGameplayValues>() != null)
     {
         playerIn         = true;
         playerValues     = other.GetComponent <PlayerGameplayValues>();
         playerController = other.GetComponent <ControllerBehaviour>();
         //player is buying
     }
 }
Esempio n. 10
0
 /**
  * End interaction with a controller
  */
 public void OnEndInteraction(ControllerBehaviour controller)
 {
     // React only if it's the controller the object is following
     if (controller == attachedController)
     {
         // Delete reference and unparent
         attachedController    = null;
         this.transform.parent = null;
         interacting           = false;
     }
 }
 /// <summary>
 /// Method to add a new player. This method must be call on server-side context
 /// </summary>
 public void AddPlayer(string playerId, ControllerBehaviour player)
 {
     if (players.ContainsKey(playerId))
     {
         players [playerId] = player;
     }
     else
     {
         players.Add(playerId, player);
     }
 }
Esempio n. 12
0
 protected void SetTarget(params object[] args)
 {
     if (args[0] == null)
     {
         target = null;
     }
     else
     {
         target = (ControllerBehaviour)args[0];
         ListenTo(target, Channel.GameObject.Destroy, _ => target = null);
     }
 }
Esempio n. 13
0
 void Start()
 {
     // Initializing the controller component:
     controller     = GetComponent <ControllerBehaviour>();
     gravity        = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); // setting the gravity value
     jumpVelocity   = Mathf.Abs((gravity * timeToJumpApex));            // setting the jump velocity
     playerRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <Animator>();
     if (controller != null)
     {
         controller.Init();
     }
 }
Esempio n. 14
0
    public void Start()
    {
        bowController       = GetComponent <BowController>();
        controllerBehaviour = GetComponent <ControllerBehaviour>();
        //if premiere partie et jamais joué avant
        print(scriptableStats);
        maxHealth    = scriptableStats.maxHealth.startValue;
        healthRegen  = scriptableStats.healthRegen.startValue;
        speed        = scriptableStats.speed.startValue;
        magazineSize = scriptableStats.maxAmmo.startValue;
        numberOfArrowStartingGame = scriptableStats.startAmmo.startValue;
        maxStamina   = scriptableStats.maxStamina.startValue;
        staminaRegen = scriptableStats.staminaRegen.startValue;


        health  = maxHealth;
        stamina = maxStamina;
    }
Esempio n. 15
0
    /**
     * Called at object's initialization
     */
    void Awake()
    {
        // Register self to globals
        Globals.controllers = this;

        // Save references
        manager = gameObject.GetComponent <VRTK_SDKManager>();

        leftController  = manager.scriptAliasLeftController;
        rightController = manager.scriptAliasRightController;

        leftBehaviour  = leftController.GetComponent <ControllerBehaviour>();
        rightBehaviour = rightController.GetComponent <ControllerBehaviour>();

        // Register callback to ParaView Object Loaded event
        Globals.ParaviewObjectLoadedCallbacks   += OnParaviewObjectLoaded;
        Globals.ParaviewObjectUnloadedCallbacks += OnParaviewObjectUnloaded;
    }
Esempio n. 16
0
    /// <summary>
    /// Bullet collider.
    /// </summary>
    /// <param name="collision">Object wich bullet collided.</param>
    void OnCollisionEnter(Collision collision)
    {
        StopAllCoroutines();
        CmdDestroy();

        //Just the server has a list with all players id.
        //This id must be use to identify player and send his points.
        if (!isServer)
        {
            return;
        }

        Destructible obj = collision.gameObject.GetComponent <Destructible> ();

        if (obj != null)
        {
            ControllerBehaviour player = PlayersManager.instance.GetPlayerById(_id);
            player._score += obj.GetPoints();
        }
    }
Esempio n. 17
0
 protected virtual bool OnMeetObtacle(ControllerBehaviour obj, CellController lastCell)
 {
     return(true);
 }
Esempio n. 18
0
 public void LoadScene(AssetReference scene) => ControllerBehaviour.LoadScene(scene);
Esempio n. 19
0
    /**
     * Attaches the slicing plan to a controller and shows it
     */
    public void ShowPlane()
    {
        ControllerBehaviour controller = Globals.controllers.getNonRadialController();

        plane.Show(controller);
    }
Esempio n. 20
0
 /**
  * Called at object's initialization
  */
 protected override void Awake()
 {
     base.Awake();
     behaviour  = GetComponent <ControllerBehaviour>();
     radialMenu = transform.FindDeepChild("RadialMenuUI/Panel").GetComponent <VRTK_RadialMenu>();
 }
Esempio n. 21
0
 protected override bool OnMeetObtacle(ControllerBehaviour obj, CellController lastCell)
 {
     console.log("meet", obj.GetType());
     return(true);
 }
Esempio n. 22
0
 void Awake()
 {
     controller = GetComponent <ControllerBehaviour>();
 }
Esempio n. 23
0
 public void Start()
 {
     playerStats         = GetComponent <PlayerGameplayValues>();
     controllerBehaviour = GetComponent <ControllerBehaviour>();
 }
 void Awake()
 {
     controller = GetComponent<ControllerBehaviour>();
 }
Esempio n. 25
0
 public void OnTriggerExit(Collider other)
 {
     playerIn         = false;
     playerValues     = null;
     playerController = null;
 }
Esempio n. 26
0
 public ControllerBehaviour(ControllerBehaviour newBehaviour)
 {
     this = newBehaviour;
 }