Inheritance: MonoBehaviour
Example #1
0
    // Use this for initialization
    void Start()
    {
        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        ikHandler = transform.Find("IkHandler");
        //sword = ikHandler.FindChild("SwordParent");
        sword = transform.Find("SwordParent");
        hand  = ikHandler.Find("Hand");

        int playerNdx = s_playerCount++;


        SetColor(m_gamepad.Color);


        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;



        //cameraBaseRotation = Camera.main.transform.rotation * Quaternion.Euler(0f, -180f, 0f);


        //baseRotation = Quaternion.identity;
        inverseBaseRotation = Quaternion.identity;
        //lastRotation = transform.rotation;
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        ikHandler = transform.Find("IkHandler");
        hand      = ikHandler.Find("Hand");

        swordEnd             = sword.Find("End");
        handSwordPlaceHolder = handJoint.Find("SwordPlaceHolder");
        handJointUp          = handJoint.Find("Up");

        debugController = GameObject.Find("Capsule").transform;

        int playerNdx = s_playerCount++;


        SetColor(m_gamepad.Color);


        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;



        //baseRotation = Quaternion.identity;
        inverseBaseRotation = Quaternion.identity;
        //lastRotation = transform.rotation;


        handBaseRotation = Quaternion.Inverse(handJoint.localRotation);
    }
Example #3
0
    private void Start()
    {
        hInput = GetComponent<HFTInput>();
        hGamepad = GetComponent<HFTGamepad>();

        //renderer = GetComponent<Renderer>();
        renderer.material.color = hGamepad.color;

    }
 void Awake()
 {
     try {
         HFTGlobalSoundHelper.GetSounds();
     } catch (System.Exception) {
         Debug.LogError("No HFTGlobalSoundHelper in scene. Please add one");
     }
     m_gamepad = GetComponent<HFTGamepad>();
 }
Example #5
0
        void Start()
        {
            m_gamepad  = GetComponent<HFTGamepad>();
            m_renderer = GetComponent<Renderer>();
            m_position = transform.localPosition;

            m_gamepad.OnNameChange += ChangeName;

            SetName(m_gamepad.Name);
            SetColor(m_gamepad.Color);
        }
    void Start()
    {
        gp                = GetComponent <HFTGamepad> ();
        dejaJoue          = false;
        horloge           = GameObject.Find("Horloge");
        characterAssigned = false;

        input = GetComponent <HFTInput> ();

        inscrireHorloge();
    }
    void Start()
    {
        actif            = false;
        gp               = GetComponent <HFTGamepad> ();
        input            = GetComponent <HFTInput> ();
        VaisseauScene    = GameObject.Find("Vaisseau");
        scrPlayerSpawner = GameObject.Find("PlayerSpawner").GetComponent <PlayerSpawner> ();
        scrPlayerMan     = GameObject.Find("PlayerMan").GetComponent <scrPlayerMan> ();
        oldGpName        = gp.Name;

        scrPlayerMan.inscrire(this.gameObject);
        gp.NetPlayer.OnDisconnect += selfDestroy;
    }
Example #8
0
    // Use this for initialization
    void Start()
    {
        m_animator    = GetComponent <Animator>();
        m_rigidbody2d = GetComponent <Rigidbody2D>();
        m_material    = GetComponent <Renderer>().material;
        m_gamepad     = GetComponent <HFTGamepad>();
        m_hftInput    = GetComponent <HFTInput>();

        SetColor(m_playerNumber++);
        SetName(m_gamepad.Name);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;
    }
Example #9
0
        void Start()
        {
            m_gamepad  = GetComponent<HFTGamepad>();
            m_renderer = GetComponent<Renderer>();
            m_position = transform.localPosition;

            m_text = transform.FindChild("NameUI/Name").gameObject.GetComponent<UnityEngine.UI.Text>();
            m_rawImage = transform.FindChild("NameUI/NameBackground").gameObject.GetComponent<UnityEngine.UI.RawImage>();
            m_rawImage.material = (Material)Instantiate(m_rawImage.material);

            m_gamepad.OnNameChange += ChangeName;

            SetName(m_gamepad.Name);
            SetColor(m_gamepad.Color);
        }
    void Start()
    {
        // Find an empty id;
        bool foo = false;
        for (int ii = 0; ii < 1000; ++ii) {
            if (!s_ids.TryGetValue(ii, out foo)) {
                m_id = ii;
                s_ids[ii] = true;
                break;
            }
        }

        m_gamepad = GetComponent<HFTGamepad>();
        m_hftInput = GetComponent<HFTInput>();
        m_gamepad.NetPlayer.OnDisconnect += OnDisconnect;
    }
Example #11
0
    // Use this for initialization
    void Start()
    {
        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        ikHandler = transform.Find("IkHandler");
        //sword = ikHandler.FindChild("SwordParent");
        sword = transform.Find("SwordParent");
        hand  = ikHandler.Find("Hand");



        int playerNdx = s_playerCount++;


        SetColor(m_gamepad.Color);


        // Delete ourselves if disconnected
        //m_gamepad.OnDisconnect += Remove;



        //cameraBaseRotation = Camera.main.transform.rotation * Quaternion.Euler(0f, -180f, 0f);


        //baseRotation = Quaternion.identity;
        //inverseBaseRotation = Quaternion.identity;
        //lastRotation = transform.rotation;



        // TEST: attach as child of player (horse)
        steering = false;
        //rope = sword.Find("Rope").gameObject;
        parentPlayer = GameObject.Find("Player");
        //transform.SetParent(parentPlayer.transform);
        //transform.position = parentPlayer.transform.FindChild("SwordCharacterPivot").position;
        movablePlayer = parentPlayer.GetComponent <MovablePlayer>();



        EventDelegateManager.instance.playerDieDelegate    += OnDie;
        EventDelegateManager.instance.restartLevelDelegate += OnRestartLevel;
    }
Example #12
0
    // Use this for initialization
    void Start()
    {
        m_renderer = GetComponent<Renderer>();
        m_gamepad = GetComponent<HFTGamepad>();
        m_hftInput = GetComponent<HFTInput>();

        int playerNdx = s_playerCount++;
        transform.position = new Vector3(
            CenterOut(playerNdx % 9)     * 2.5f,
            CenterOut(playerNdx / 9 % 5) * 2.5f,
            transform.position.z);

        SetName(m_gamepad.Name);
        SetColor(m_gamepad.Color);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;
    }
    // Use this for initialization
    void Start()
    {
        m_animator = GetComponent <Animator>();
        //m_rigidbody2d = GetComponent<Rigidbody2D>();
        m_material = GetComponent <Renderer>().material;
        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        SetColor(m_playerNumber++);
        SetName(m_gamepad.Name);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;

        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;

        gameManager = FindObjectOfType <GameManager>();
    }
Example #14
0
    // Use this for initialization
    void Start()
    {
        m_renderer = GetComponent <Renderer>();
        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        int playerNdx = s_playerCount++;

        transform.position = new Vector3(
            CenterOut(playerNdx % 9) * 2.5f,
            CenterOut(playerNdx / 9 % 5) * 2.5f,
            transform.position.z);

        SetName(m_gamepad.Name);
        SetColor(m_gamepad.Color);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;
    }
Example #15
0
    void Start()
    {
        // Find an empty id;
        bool foo = false;

        for (int ii = 0; ii < 1000; ++ii)
        {
            if (!s_ids.TryGetValue(ii, out foo))
            {
                m_id      = ii;
                s_ids[ii] = true;
                break;
            }
        }

        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();
        m_gamepad.NetPlayer.OnDisconnect += OnDisconnect;
    }
Example #16
0
    void Start()
    {
        // Find an empty id;
        bool foo = false;

        for (int ii = 0; ii < 1000; ++ii)
        {
            if (!s_ids.TryGetValue(ii, out foo))
            {
                m_id      = ii;
                s_ids[ii] = true;
                break;
            }
        }

        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;
    }
Example #17
0
    // Use this for initialization
    void Start()
    {
        m_gamepad  = GetComponent <HFTGamepad>();
        m_hftInput = GetComponent <HFTInput>();

        int playerNdx = s_playerCount++;

        //transform.position = new Vector3(
        //    CenterOut(playerNdx % 9) * 2.5f,
        //    CenterOut(playerNdx / 9 % 5) * 2.5f,
        //    transform.position.z);

        //SetName(m_gamepad.Name);
        SetColor(m_gamepad.Color);

        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;


        //baseRotation = Quaternion.identity;
        inverseBaseRotation = Quaternion.identity;
        lastRotation        = transform.rotation;
    }
Example #18
0
    // Use this for initialization
    void Start()
    {
        m_animator = GetComponent<Animator>();
        m_rigidbody2d = GetComponent<Rigidbody2D>();
        m_material = GetComponent<Renderer>().material;
        m_gamepad = GetComponent<HFTGamepad>();
        m_hftInput = GetComponent<HFTInput>();

        SetColor(m_playerNumber++);
        SetName(m_gamepad.Name);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;

        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;
    }
    void Start()
    {
        // Find an empty id;
        bool foo = false;
        for (int ii = 0; ii < 1000; ++ii) {
            if (!s_ids.TryGetValue(ii, out foo)) {
                m_id = ii;
                s_ids[ii] = true;
                break;
            }
        }

        m_gamepad = GetComponent<HFTGamepad>();
        m_hftInput = GetComponent<HFTInput>();

        // Delete ourselves if disconnected
        m_gamepad.OnDisconnect += Remove;
    }
Example #20
0
        void Start()
        {
            m_gamepad  = GetComponent<HFTGamepad>();
            m_renderer = GetComponent<Renderer>();
            m_position = transform.localPosition;

            m_text = transform.FindChild("NameUI/Name").gameObject.GetComponent<UnityEngine.UI.Text>();
            m_rawImage = transform.FindChild("NameUI/NameBackground").gameObject.GetComponent<UnityEngine.UI.RawImage>();
            m_rawImage.material = (Material)Instantiate(m_rawImage.material);

            // Notify us if the name changes.
            m_gamepad.OnNameChange += ChangeName;

            // Delete ourselves if disconnected
            m_gamepad.OnDisconnect += Remove;

            SetName(m_gamepad.Name);
            SetColor(m_gamepad.Color);
        }
Example #21
0
    void Awake()
    {
        m_gamepad = GetComponent<HFTGamepad>();

        m_buttonState = new bool[m_gamepad.buttons.Length];
        m_lastButtonState = new bool[m_gamepad.buttons.Length];
    }
        void Start()
        {
            m_gamepad  = GetComponent<HFTGamepad>();
            m_renderer = GetComponent<Renderer>();
            m_position = transform.localPosition;

            m_text = transform.FindChild("NameUI/Name").gameObject.GetComponent<UnityEngine.UI.Text>();
            m_rawImage = transform.FindChild("NameUI/NameBackground").gameObject.GetComponent<UnityEngine.UI.RawImage>();
            m_rawImage.material = (Material)Instantiate(m_rawImage.material);

            m_gamepad.OnNameChange += ChangeName;

            SetName(m_gamepad.Name);
            SetColor(m_gamepad.Color);

            m_playerRigidbody = GetComponent<Rigidbody>();
            m_impulseParticles = m_impulseParticleEffectHolder.GetComponent<ParticleSystem>();
            m_impulseParticles.startColor = m_gamepad.Color;
            m_playerLight = GetComponentInChildren<Light>();
            m_playerLight.color = m_gamepad.Color;

            m_gameManager = FindObjectOfType<GameManager>();
        }
Example #23
0
 void Start()
 {
     m_gamepad  = GetComponent <HFTGamepad>();
     m_hftInput = GetComponent <HFTInput>();
 }
Example #24
0
    // Use this for initialization
    void Start()
    {
        m_rigidbody2d = GetComponent<Rigidbody2D>();
        m_material = GetComponent<Renderer>().material;
        m_gamepad = GetComponent<HFTGamepad>();

        visibility = gameObject.GetComponent<PlayerVisibility>();

        PlayerManager.AddPlayer(this);
        SetChasing(PlayerManager.ShouldISeek());
        int playerNumber = UnityEngine.Random.Range(0,100);//PlayerManager.NumberPlayers;
        SetColor(playerNumber-1);
        SetName(m_gamepad.Name);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;

        score.catchPlayerEvent += delegate() {
            //visibility.StartBlinking();
            //refreshName();
            m_netPlayer.SendCmd("showGif", new CustomTextParcel("Tom is lazy"));
        };
        score.caughtEvent += delegate ()
        {
            //visibility.PermanentOn();
            if(!justCaught)
            {
                m_netPlayer.SendCmd("showGif", new CustomTextParcel("Tom is lazy"));
                m_netPlayer.SendCmd("customText", new CustomTextParcel("You've been caught! Wait till next round."));
                gameObject.AddComponent<PlayerStartScreen>();

                PlayerManager.NumberCaught++;
                Debug.Log("So far caught: " + PlayerManager.NumberCaught);

                //See if the game ends!
                if (PlayerManager.NumberHiding == PlayerManager.NumberCaught)
                {
                    RoundManager.Instance.EndGame(true); //seekers win
                }
                justCaught = true;
            }
        };

        //refreshName();
    }