Наследование: MonoBehaviour
Пример #1
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);
    }
Пример #2
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;
    }
Пример #3
0
    private void Start()
    {
        hInput = GetComponent<HFTInput>();
        hGamepad = GetComponent<HFTGamepad>();

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

    }
Пример #4
0
    public void Start()
    {
        walkParticleSystem = (Instantiate(walkParticles, new Vector3(this.transform.position.x + this.transform.gameObject.GetComponent <CharacterController>().bounds.extents.x - .2f, this.transform.position.y - this.transform.GetComponent <CharacterController>().bounds.extents.y + .4f, this.transform.position.z), Quaternion.identity) as ParticleSystem).transform.gameObject;
        walkParticleSystem.transform.SetParent(this.gameObject.transform);
        walkParticleSystem.gameObject.SetActive(false);
        walkParticleSystem.transform.SetParent(this.gameObject.transform);

        Debug.Log("Start Called");
        // Fancy code that grabs the first integer in the frame count
        Int32.TryParse(System.Text.RegularExpressions.Regex.Replace(this.GetComponent <MeshFilter>().mesh.name, @"[^\d]", ""), out currentFrame);

        currentFrame -= 1; // subtract one for array index accsess
        spawnParticle.transform.position = transform.position;
        spawnParticle.enableEmission     = true;
        jumpParticle.enableEmission      = true;

        jumpParticle.playOnAwake  = true;
        spawnParticle.playOnAwake = true;

        // cache frequently used components
        controller      = GetComponent <CharacterController>();
        meshFilter      = GetComponent <MeshFilter>();
        audioSource     = GetComponent <AudioSource>();
        hftInput        = GetComponent <HFTInput>();
        mainCamera      = Camera.main;
        meshFilter.mesh = jumpFrame;

        GameObject spawner = GameObject.FindWithTag(pipeTag);

        transform.position = spawner.transform.position + spawner.transform.up * 3.0F;
        moveDirection.y    = jumpSpeed * spawner.transform.up.y;

        // Grab the child object of the pipe prefab and tween its color to pipeSpawnColor as set in the inspector
        spawner.transform.GetChild(0).GetComponent <Renderer>().material.DOColor(pipeSpawnColor, 0.5f);

        Sequence pipeSequence = DOTween.Sequence();

        // stupid magica voxel and your crazy scaling smh
        if (growTween)
        {
            pipeSequence.Append(spawner.transform.DOScale(0.12f, 0.15f).SetEase(Ease.InOutBounce).SetLoops(1));
            pipeSequence.Append(spawner.transform.DOScale(0.08597419f, 0.5f).SetEase(Ease.InOutElastic).SetLoops(1));
        }
        else
        {
            pipeSequence.Append(spawner.transform.DOScale(0.05f, 0.5f).SetEase(Ease.InOutBounce).SetLoops(1));
            pipeSequence.Append(spawner.transform.DOScale(0.08597419f, 0.3f).SetEase(Ease.InOutElastic).SetLoops(1));
        }

        // after pipe tween effect play the spawn sound
        audioSource.PlayOneShot(spawn_sound);
        // apply a small bounce effect to the character after spawn
        transform.DOScale(0.4f, 0.5f).SetEase(Ease.OutBounce).SetLoops(1);
        Destroy((Instantiate(spawnParticle, this.transform.position, Quaternion.identity) as ParticleSystem).transform.gameObject, 1.5f);
    }
Пример #5
0
    protected void Start()
    {
        m_hftInput = GetComponent<HFTInput>();
        _rigidbody = GetComponent<Rigidbody2D>();
        grid.SnapToGrid(transform);
        transform.position += gridOffset;

        playerUI = GetComponent<MazePlayerUI>();
        //score.catchPlayerEvent += MoveToRandomSpawnPoint;
        onRewardHit += score.CollideWithScore;
    }
    void Start()
    {
        gp                = GetComponent <HFTGamepad> ();
        dejaJoue          = false;
        horloge           = GameObject.Find("Horloge");
        characterAssigned = false;

        input = GetComponent <HFTInput> ();

        inscrireHorloge();
    }
Пример #7
0
    public void Start()
    {
        controller = GetComponent <CharacterController>();
        meshFilter = GetComponent <MeshFilter>();
        hftInput   = GetComponent <HFTInput>();

        meshFilter.mesh = basicFrame;

        transform.position = new Vector3(leftBound + UnityEngine.Random.value * (rightBound - leftBound),
                                         lowerBound + UnityEngine.Random.value * (upperBound - lowerBound), 2);
    }
Пример #8
0
	public void Start()
	{	
		controller = GetComponent<CharacterController>();
		meshFilter = GetComponent<MeshFilter>();
		hftInput = GetComponent<HFTInput>();
		
		meshFilter.mesh = basicFrame;

		transform.position = new Vector3(leftBound + UnityEngine.Random.value * (rightBound - leftBound),
		                             lowerBound + UnityEngine.Random.value * (upperBound - lowerBound), 2);

	}
Пример #9
0
    public void Start()
    {
		
		walkParticleSystem = (Instantiate(walkParticles, new Vector3(this.transform.position.x + this.transform.gameObject.GetComponent<CharacterController>().bounds.extents.x - .2f, this.transform.position.y - this.transform.GetComponent<CharacterController>().bounds.extents.y + .4f, this.transform.position.z), Quaternion.identity) as ParticleSystem).transform.gameObject;
		walkParticleSystem.transform.SetParent(this.gameObject.transform);
		walkParticleSystem.gameObject.SetActive(false);
		walkParticleSystem.transform.SetParent(this.gameObject.transform);

		Debug.Log ("Start Called");
        // Fancy code that grabs the first integer in the frame count
       Int32.TryParse(System.Text.RegularExpressions.Regex.Replace(this.GetComponent<MeshFilter>().mesh.name, @"[^\d]", ""), out currentFrame);
       
       currentFrame -= 1; // subtract one for array index accsess 
       spawnParticle.transform.position = transform.position;
       spawnParticle.enableEmission = true;
       jumpParticle.enableEmission = true;

       jumpParticle.playOnAwake = true;
       spawnParticle.playOnAwake = true;

       // cache frequently used components
       controller = GetComponent<CharacterController>();
       meshFilter = GetComponent<MeshFilter>();
       audioSource = GetComponent<AudioSource>();
       hftInput = GetComponent<HFTInput>();
       mainCamera = Camera.main;
       meshFilter.mesh = jumpFrame;
     
	   GameObject spawner = GameObject.FindWithTag(pipeTag);
	   transform.position = spawner.transform.position + spawner.transform.up * 3.0F;
	   moveDirection.y = jumpSpeed * spawner.transform.up.y;

       // Grab the child object of the pipe prefab and tween its color to pipeSpawnColor as set in the inspector
       spawner.transform.GetChild(0).GetComponent<Renderer>().material.DOColor(pipeSpawnColor, 0.5f);

       Sequence pipeSequence = DOTween.Sequence();
	   // stupid magica voxel and your crazy scaling smh
        if (growTween) {
			pipeSequence.Append(spawner.transform.DOScale(0.12f, 0.15f).SetEase(Ease.InOutBounce).SetLoops(1));
			pipeSequence.Append(spawner.transform.DOScale(0.08597419f, 0.5f).SetEase(Ease.InOutElastic).SetLoops(1));
		} else {
			pipeSequence.Append(spawner.transform.DOScale(0.05f, 0.5f).SetEase(Ease.InOutBounce).SetLoops(1));
			pipeSequence.Append(spawner.transform.DOScale(0.08597419f, 0.3f).SetEase(Ease.InOutElastic).SetLoops(1));
		}

       // after pipe tween effect play the spawn sound
	   audioSource.PlayOneShot (spawn_sound);
       // apply a small bounce effect to the character after spawn
       transform.DOScale(0.4f, 0.5f).SetEase(Ease.OutBounce).SetLoops(1);
       Destroy((Instantiate(spawnParticle, this.transform.position, Quaternion.identity) as ParticleSystem).transform.gameObject,1.5f);

    }
    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;
    }
Пример #11
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;
    }
    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;
    }
Пример #13
0
        // Use this for initialization
        private void Start()
        {
            input = GetComponent<HFTInput>();

            input.SpecifyButtonNameToButtonIndex("1", 2);
            input.SpecifyButtonNameToButtonIndex("2", 3);
            input.SpecifyButtonNameToButtonIndex("3", 4);
            input.SpecifyButtonNameToButtonIndex("4", 5);
            input.SpecifyButtonNameToButtonIndex("5", 6);
            input.SpecifyButtonNameToButtonIndex("6", 7);
            input.SpecifyButtonNameToButtonIndex("7", 8);
            input.SpecifyButtonNameToButtonIndex("8", 9);
            input.SpecifyButtonNameToButtonIndex("9", 10);

            var team = FindObjectOfType<TeamManager>().JoinTeam(this);
            GetComponent<HFTGamepad>().Color = team.color;
        }
Пример #14
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;
    }
Пример #15
0
    /// <summary>
    /// ///////////////////////////// SHARED GAME MODE FUNCTIONS ////////////////////////////////
    /// </summary>

    public void PlayerConstructor(/*string givenName,*/ Sprite givenPicture, GameObject memefab, GameObject votefab, ModeratorScript[] mods, ChatManagerScript cm)
    {
        DontDestroyOnLoad(this);
        m_soundPlayer          = GetComponent <HFTSoundPlayer>();
        banDuration            = 5;
        amIBanned              = false;
        playerProfilePicture   = givenPicture;
        playerScore            = 0;
        memeMessagePrefab      = memefab;
        voteMessagePrefab      = votefab;
        managerScriptReference = cm;
        chatModerators         = mods;
        myHFTInput             = GetComponent <HFTInput>();
        playerColor            = GetComponent <HFTGamepad>().color;

        //playerName = givenName;
        //gameObject.name = givenName;
    }
Пример #16
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;
    }
Пример #17
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;

        gameManager = FindObjectOfType <GameManager>();
    }
Пример #18
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;
    }
    void Start()
    {
        //Debug.Log ("player start");
        DontDestroyOnLoad(this.gameObject);
        m_hftInput    = GetComponent <HFTInput>();
        m_soundPlayer = GetComponent <HFTSoundPlayer>();
        playerDir     = Vector2.right;

        manager = GameObject.Find("Manager").GetComponent <Manager> ();
        manager.addPlayer(this.gameObject);
        GameObject.Find("CharacterCreator").GetComponent <CharacterCreator>().createCharacter(body, head, GetComponent <HFTGamepad>().color);

        if (Application.loadedLevel == 0)
        {
            GameObject.Find("StagingAreaManager").GetComponent <StagingAreaManager> ().addPlayer(this.gameObject);
        }

        transform.localScale = new Vector2(0.5f, 0.5f);
    }
Пример #20
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;
    }
Пример #21
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;
    }
Пример #22
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;
    }
Пример #23
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;
    }
Пример #25
0
 public void Awake()
 {
     _seedGamepad = GetComponent <SeedGamepad>();
     _htfInput    = GetComponent <HFTInput>();
     audioSource  = GetComponent <AudioSource>();
 }
Пример #26
0
 void Start()
 {
     m_gamepad  = GetComponent <HFTGamepad>();
     m_hftInput = GetComponent <HFTInput>();
 }
Пример #27
0
    // might have to change the script execution error for this
    // Use this for initialization
    void Start()
    {
        restHorz = true;
        restVert = true;
        celebrated = false;
        dead = false;

        source = this.gameObject.GetComponent<AudioSource> ();

        // Grab the Map Object from the Player
        GameObject mapObject = GameObject.FindWithTag ("Map");
        map = mapObject.GetComponent<MapGeneration>().Map; // grab the refrence from the map generation
        endCell = new Vector2(mapObject.GetComponent<MapGeneration>().getEndX(), mapObject.GetComponent<MapGeneration>().getEndY());
        onSpawn(ref currentCell);
        Debug.Log("Current Cell: " + currentCell.x + "," + currentCell.y);
        mapSize = mapObject.GetComponent<MapGeneration>().Size;

        hftInput = this.gameObject.GetComponent<HFTInput>();
        this.gameObject.transform.DOScale( new Vector3(0.7f,1f,0.7f), 0.9f).SetEase(Ease.OutBounce);
        this.gameObject.transform.DOJump(this.transform.position, 2.5f, 1, 0.40f, false);

        MapGeneration.doDestroy += die;
    }
Пример #28
0
	// Use this for initialization
	void Start ()
	{
	    input = GetComponent<HFTInput>();
	    material = GetComponent<Renderer>().material;
	}