Exemplo 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);
 }
Exemplo n.º 3
0
    public void Start()
    {
        playerStats = GetComponentInParent <PlayerGameplayValues>();

        controllerBehaviour = transform.parent.GetComponent <ControllerBehaviour>();
        healthBehaviour     = transform.parent.GetComponent <HealthBehaviour>();
        bowController       = transform.parent.GetComponent <BowController>();
    }
Exemplo n.º 4
0
 void Start()
 {
     listReference = GameObject.FindGameObjectWithTag("Spawner").GetComponent <ControllerBehaviour>();
     myRend        = GetComponent <MeshRenderer>();
     SetPlayerColor();
     curLives = maxLives;
     myRB     = GetComponent <Rigidbody>();
 }
Exemplo n.º 5
0
 void Start()
 {
     shipListController = GetComponent <ControllerBehaviour>();
     playerConnect      = new bool[4];
     for (int i = 0; i < playerConnect.Length; i++)
     {
         playerConnect[i] = false;
     }
 }
Exemplo 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);
        }
    }
Exemplo n.º 7
0
    public void Start()
    {
        playerStats = GetComponent <PlayerGameplayValues>();

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

        StartCoroutine(GiveArrows());
    }
Exemplo n.º 8
0
    /**
     * 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;
    }
Exemplo 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
     }
 }
Exemplo 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;
     }
 }
Exemplo n.º 11
0
 /// <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);
     }
 }
Exemplo 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);
     }
 }
Exemplo 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();
     }
 }
Exemplo 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;
    }
Exemplo 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;
    }
Exemplo 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();
        }
    }
Exemplo n.º 17
0
 protected virtual bool OnMeetObtacle(ControllerBehaviour obj, CellController lastCell)
 {
     return(true);
 }
Exemplo n.º 18
0
 public void LoadScene(AssetReference scene) => ControllerBehaviour.LoadScene(scene);
Exemplo n.º 19
0
    /**
     * Attaches the slicing plan to a controller and shows it
     */
    public void ShowPlane()
    {
        ControllerBehaviour controller = Globals.controllers.getNonRadialController();

        plane.Show(controller);
    }
Exemplo 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>();
 }
Exemplo n.º 21
0
 protected override bool OnMeetObtacle(ControllerBehaviour obj, CellController lastCell)
 {
     console.log("meet", obj.GetType());
     return(true);
 }
Exemplo n.º 22
0
 void Awake()
 {
     controller = GetComponent <ControllerBehaviour>();
 }
Exemplo n.º 23
0
 public void Start()
 {
     playerStats         = GetComponent <PlayerGameplayValues>();
     controllerBehaviour = GetComponent <ControllerBehaviour>();
 }
 void Awake()
 {
     controller = GetComponent<ControllerBehaviour>();
 }
Exemplo n.º 25
0
 public void OnTriggerExit(Collider other)
 {
     playerIn         = false;
     playerValues     = null;
     playerController = null;
 }
Exemplo n.º 26
0
 public ControllerBehaviour(ControllerBehaviour newBehaviour)
 {
     this = newBehaviour;
 }