Exemplo n.º 1
0
 void Start()
 {
     if (GetComponent <Hunter>())
     {
         hunterRef = GetComponent <Hunter>();
     }
     nanim = gameObject.GetComponent <NetworkAnimator>();
 }
Exemplo n.º 2
0
    public override void PreStartClient()
    {
        base.PreStartClient();
        NetworkAnimator netAnimator = GetComponent<NetworkAnimator>();

        for (int i = 0; i < GetComponent<Animator>().parameterCount; i++)
            netAnimator.SetParameterAutoSend(i, true);
    }
Exemplo n.º 3
0
 public void InitAnimator(GameObject avatar)
 {
     if (avatar != null)
     {
         avatarAnimator  = avatar.GetComponent <Animator>();
         networkAnimator = avatar.GetComponent <NetworkAnimator>();
         networkAnimator.SetParameterAutoSend(3, true);
     }
 }
Exemplo n.º 4
0
	void Start()
	{
		weaponCol.setValues(gameObject, this);
		weaponCol.active(false);
		swordAni = GetComponent<NetworkAnimator>();
		if (swordAni == null)
			Debug.LogError ("Setup: Failed to find NetworkAnimator");
		meleeHash = swordAni.animator.GetLayerIndex("WeaponLayer");
	}
Exemplo n.º 5
0
    private void Awake()
    {
        _playerShooting = GetComponent <PlayerShooting>();
        _playerUniverse = GetComponent <PlayerUniverse>();
        _anim           = GetComponent <NetworkAnimator>();

        GetComponent <Player>().playerName  = "Bot";
        GetComponent <Player>().playerColor = Color.white;
    }
Exemplo n.º 6
0
 private void Init()
 {
     if (!this.m_Initialized)
     {
         this.m_Initialized      = true;
         this.m_AnimSync         = base.target as NetworkAnimator;
         this.m_AnimatorProperty = base.serializedObject.FindProperty("m_Animator");
     }
 }
Exemplo n.º 7
0
    void Awake()
    {
        zombieAnimations = GetComponent<Animator>();
        networkAnim = GetComponent<NetworkAnimator>();
        agent = GetComponent<NavMeshAgent>(); 
        networkIdentity = GetComponent<NetworkIdentity>();
        playerTransform = GameObject.FindWithTag("Zombie").transform;

    }
Exemplo n.º 8
0
    /**
     * This method is called once when this component is loaded in the scene
     */
    void Start()
    {
        // Get relevant components
        anim   = gameObject.transform.GetComponent <NetworkAnimator> ();
        player = gameObject.transform.GetComponent <Player> ();

        // Set actual health to max health
        health = maxHealth;
    }
Exemplo n.º 9
0
	void Start()
	{
		curAmmo = maxAmmo;
		gunAni = GetComponent<NetworkAnimator>();
		playCam = this.GetComponent<PlayerCamera>();
		if (gunAni == null)
			Debug.LogError ("Setup: Failed to find NetworkAnimator");
		curTeam = this.gameObject.GetComponent<PlayerController>().team;
	}
Exemplo n.º 10
0
 void Awake()
 {
     zombieAnimations = GetComponent <Animator>();
     networkAnim      = GetComponent <NetworkAnimator>();
     agent            = GetComponent <NavMeshAgent>();
     networkIdentity  = GetComponent <NetworkIdentity>();
     PLAYER           = GameObject.FindWithTag("Player");
     Explode.GetComponent <ParticleSystem>().Stop();
     es = GameObject.Find("ZombieSpawner").GetComponent <ZombieSpawner>();
 }
Exemplo n.º 11
0
 private void Init()
 {
     if (this.m_Initialized)
     {
         return;
     }
     this.m_Initialized      = true;
     this.m_AnimSync         = this.target as NetworkAnimator;
     this.m_AnimatorProperty = this.serializedObject.FindProperty("m_Animator");
 }
Exemplo n.º 12
0
    private void Awake()
    {
        anim = GetComponent <NetworkAnimator>();
        col  = GetComponent <CapsuleCollider>();
        rb   = GetComponent <Rigidbody>();


        orgColHeight     = col.height;
        orgVectColCenter = col.center;
    }
Exemplo n.º 13
0
 private void Awake()
 {
     // Debug.Log("Test");
     // Setting up references.
     m_GroundCheck   = transform.Find("GroundCheck");
     m_CeilingCheck  = transform.Find("CeilingCheck");
     m_Anim          = GetComponent <Animator>();
     networkAnimator = gameObject.GetComponent <NetworkAnimator>();
     m_Rigidbody2D   = GetComponent <Rigidbody2D>();
 }
Exemplo n.º 14
0
 void Awake()
 {
     player = GetComponent <NetPlayer> ();
     // Recuperamos la referencia del componente NetworkAnimator
     anim = GetComponent <NetworkAnimator> ();
     // Recuperamos la referencia del componente NetFPSController
     fpsController = GetComponent <NetFPSController> ();
     // Recuperamos la referencia del componente NetShoot
     netShoot = GetComponent <NetShoot> ();
 }
Exemplo n.º 15
0
    void Update()
    {
        if (localPlayer == null)
        {
            localPlayer = GameObject.Find("local player");
            if (controlPanel.activeSelf)
            {
                controlPanel.SetActive(false);
            }
        }
        else
        {
            if (animator == null || networkAnimator == null || actionControl == null)
            {
                animator        = localPlayer.GetComponent <Animator>();
                networkAnimator = localPlayer.GetComponent <NetworkAnimator>();
                actionControl   = localPlayer.GetComponent <ActionControl>();
                localId         = actionControl.netId.ToString();
            }
            if (!controlPanel.activeSelf && !disableControl)
            {
                ResetControl();
            }
            if (disableControl && controlPanel.activeSelf)
            {
                controlPanel.SetActive(false);
            }
        }

        if (oponent == null)
        {
            if (isSet)
            {
                isSet = false;
            }
            oponent = GameObject.Find("oponent");
        }
        else
        {
            if (!isSet)
            {
                shootAnimator.SetTrigger("Shoot");
                RefreshEverything();
                actionControl.SetOwnRatio(localPlayer.GetComponent <NetworkIdentity>().netId.ToString(), localPlayer.GetComponent <Player>().ratio);
                isSet = true;
            }
        }

        if (localPlayer == null && oponent == null && !isRefresed)
        {
            RefreshEverything();
        }

        GetKeyInput();
    }
Exemplo n.º 16
0
    private void Start()
    {
        _anim = GetComponent <NetworkAnimator>();
        // Main roaming camera of the scene
        _mainCamera = Camera.main;

        EnablePlayer();

        OnNameChanged(playerName);
        OnColorChanged(playerColor);
    }
Exemplo n.º 17
0
 // Start is called before the first frame update
 void Start()
 {
     animator = GetComponent <Animator>();
     animNet  = GetComponent <NetworkAnimator>();
     if (animator == null)
     {
         Debug.LogError("Error: no animator in door object");
         GetComponent <door>().enabled = false;
         return;
     }
 }
Exemplo n.º 18
0
    private void Start()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        animator = GetComponent <NetworkAnimator>();
        movement = GetComponent <PlayerMovement>();
        dmgable  = GetComponent <Damageable>();
    }
Exemplo n.º 19
0
 protected void Start()
 {
     if (isServer)
     {
         m_agent           = GetComponent <NavMeshAgent>();
         m_unitController  = GetComponent <UnitController>();
         m_networkAnimator = GetComponent <NetworkAnimator>();
         SetRangeInWorldSpace(m_rangeAttack);
     }
     m_currentHealth = m_maxHealth;
     m_lifeBar.transform.parent.GetComponent <Image>().enabled = false;
 }
        void Init()
        {
            if (m_Initialized)
            {
                return;
            }

            m_Initialized = true;
            m_AnimSync    = target as NetworkAnimator;

            m_AnimatorProperty = serializedObject.FindProperty("m_Animator");
        }
Exemplo n.º 21
0
    void Start()
    {
        if (SceneManager.GetActiveScene().name == "Lobby")
        {
            return;
        }

        NetworkAnimator netAnimator = GetComponent <NetworkAnimator>();

        for (int i = 0; i < netAnimator.animator.parameterCount; i++)
        {
            netAnimator.SetParameterAutoSend(i, true);
        }

        this._poopCameraPos = transform.GetChild(2);
        bunnyPoop           = Resources.Load <GameObject>("Prefabs/poop");
        playerInfo          = GetComponent <PlayerInformation>();
        if (!this.isLocalPlayer)
        {
            return;
        }

        _controller = GetComponent <CharacterController>();
        _timer      = 0;
        _fireRate   = 0.2f;

        // Set custom attributes for class:
        PlayerEffects pe = GetComponent <PlayerEffects>();

        pe.CmdSetAttributes(1.0f, 1.0f, 1.0f, 1.5f);

        // Add abilities to class:
        PlayerAbilityManager abilityManager = GetComponent <PlayerAbilityManager>();
        SuperJump            sj             = gameObject.AddComponent <SuperJump>();

        sj.init(10);
        GrenadePoop gp = gameObject.AddComponent <GrenadePoop>();

        gp.init();
        abilityManager.abilities.Add(sj);
        abilityManager.abilities.Add(gp);


        GameObject.Find("AbilityPanel").GetComponent <AbilityPanel>().setupPanel(abilityManager);

        this._alertOverlay = GameObject.Find("Alert").GetComponent <Image>();
        this._alertSound   = Resources.Load <AudioClip>("Audio/BunnyAlert");
        CmdGetEnemies();

        this._playerController = GetComponent <PlayerController>();
        this._alertReady       = false;
        StartCoroutine(alertCooldown(2.0f));
    }
Exemplo n.º 22
0
 void Awake()
 {
     _anim    = GetComponent <Animator>();
     _netAnim = GetComponent <NetworkAnimator>();
     _rb      = GetComponent <Rigidbody2D>();
     _netAnim.SetParameterAutoSend(0, true);
     _netAnim.SetParameterAutoSend(1, true);
     _netAnim.SetParameterAutoSend(2, true);
     _netAnim.SetParameterAutoSend(3, true);
     _netAnim.SetParameterAutoSend(4, true);
     _netAnim.SetParameterAutoSend(5, true);
 }
Exemplo n.º 23
0
 void Start()
 {
     if (!isLocalPlayer) return;
     animator = GetComponent<Animator>();
     networkAnimator = GetComponent<NetworkAnimator>();
     networkAnimator.SetParameterAutoSend(0, true);
     networkAnimator.SetParameterAutoSend(1, true);
     networkAnimator.SetParameterAutoSend(2, true);
     networkAnimator.SetParameterAutoSend(3, true);
     networkAnimator.SetParameterAutoSend(4, true);
     Camera.main.GetComponent<OrbitControls>().target = transform;
 }
Exemplo n.º 24
0
    void Start()
    {
        characterController = GetComponent <CharacterController>();
        playerCollider      = GetComponent <Collider>();
        animator            = GetComponent <Animator>();
        networkAnimator     = GetComponent <NetworkAnimator>();
        playerCombat        = GetComponent <PlayerCombat>();

        StartCoroutine(DeactivateGravity(GameManager.instance.matchSettings.playerLoadTime));
        animator.SetFloat("Body_Horizontal_f", -0.005f);
        animator.SetFloat("Body_Vertical_f", -0.01f);
    }
Exemplo n.º 25
0
    // either a line render or a light

    // Start is called before the first frame update
    void Start()
    {
        nanim          = gameObject.GetComponent <NetworkAnimator>();
        horse          = GameObject.Find("Unnicorn").gameObject.GetComponent <Horse>();
        ProtectorSpawn = GameObject.FindGameObjectWithTag("ProtectorSpawn");
        gameObject.transform.position = ProtectorSpawn.transform.position;

        // setting up ui
        abilitiesText.text  = power.ToString();
        decoyAmmoText.text  = numberOfDecoys.ToString();
        shieldAmmoText.text = numberOfShields.ToString();
    }
Exemplo n.º 26
0
    void Start()
    {
        Monster             = GetComponent <Monster>();
        anim                = GetComponent <Animator>();
        netAnim             = GetComponent <NetworkAnimator>();
        characterController = GetComponent <CharacterController>();

        for (int i = 0; i < anim.parameterCount; i++)
        {
            netAnim.SetParameterAutoSend(i, true);
        }
    }
Exemplo n.º 27
0
    protected override void AdditionalStart()
    {
        animator        = GetComponent <Animator>();
        networkAnimator = GetComponent <NetworkAnimator>();
        weaponHolder    = GetComponent <WeaponHolder>();

        // Disable minimap icon for enemies
        if (!isLocalPlayer)
        {
            transform.GetChild(0).gameObject.SetActive(false);
        }
    }
Exemplo n.º 28
0
 void Start()
 {
     if (!isLocalPlayer)
     {
         return;
     }
     anim  = GetComponent <NetworkAnimator> ();
     anim2 = GetComponent <Animator> ();
     rb2d  = GetComponent <Rigidbody2D> ();
     bc    = bc.GetComponent <BoxCollider2D> ();
     Slidecollider.gameObject.SetActive(false);
 }
 private void Start()
 {
     animator        = GetComponent <Animator>();
     networkAnimator = GetComponent <NetworkAnimator>();
     if (isLocalPlayer)
     {
         Subscribe();
     }
     else
     {
         animator.applyRootMotion = false;
     }
 }
Exemplo n.º 30
0
    private void Start()
    {
        m_animator = GetComponent <Animator>();
        m_rb       = GetComponent <Rigidbody2D>();
        m_sr       = GetComponent <SpriteRenderer>();
        m_pj       = GetComponent <PlayerJump>();
        m_pj.JumpEvent.AddListener(OnJumpEvent);
        m_pm = GetComponent <PunchManager>();
        m_pm.PunchEvent.AddListener(OnPunchEvent);
        m_na = GetComponent <NetworkAnimator>();

        m_animator.runtimeAnimatorController = CharSelector.GetInstance().chars[controllerIndex];
    }
        private void Initialize()
        {
            if (m_Initialized)
            {
                return;
            }

            m_Initialized = true;
            m_Target      = target as NetworkAnimator;

            m_AnimatorProperty = serializedObject.FindProperty("m_Animator");
            m_AnimatorLabel    = new GUIContent("Animator", "The Animator component to synchronize.");
        }
Exemplo n.º 32
0
 void Start()
 {
     anim       = GetComponent <NetworkAnimator>();
     mainCamera = Camera.main.gameObject;
     daspeed    = speed;
     EnablePlayer();
     yposition = originaly;
     timer     = Time.time;
     runspeed  = controller.m_RunSpeed;
     OnColorChanged(playerColor);
     OnNameChanged(playerName);
     energystatus.text = "Energy: " + fatigue.ToString();
 }
Exemplo n.º 33
0
        void Init()
        {
            if (m_Initialized)
            {
                return;
            }

            m_Initialized = true;
            m_AnimSync    = target as NetworkAnimator;

            m_AnimatorProperty = serializedObject.FindProperty("m_Animator");
            m_AnimatorLabel    = TextUtility.TextContent("Animator", "The Animator component to synchronize.");
        }
Exemplo n.º 34
0
	void Awake () {
		m_Hp = GetComponent<HasHP>();
		m_Hp.hp = hpMax;
		m_Hp.postDead = Die;

		// components
		m_Renderers = GetComponent<CharacterRenderer> ();
		m_Animator = GetComponent<Animator>();
		m_NetworkAnimator = GetComponent<NetworkAnimator>();
		m_InterpolatePosition = gameObject.AddComponent<InterpolatePosition>();

		// detector
		crateDetector.doObtain = Obtain;
		damageDetector.doDamage = Hit;
		
		terrainDetector.postDetect = (Collision) =>
		{
			m_Floating = false;
			terrainDetector.gameObject.SetActive(false);
		};
	}
    void Awake()
    {
        id = s_Random.Next();

        m_Hp = GetComponent<PropertyHP>();
        m_Hp.hp = hpMax;
        m_Hp.postDead = Die;

        // life state
        {
            hitDisabled.postChanged += (_counter, _val) =>
            {
                if (_counter == 0)
                    damageDetector.enabled = true;
                else if (_counter.old == 0)
                    damageDetector.enabled = false;
            };
        }

        // components
        m_NetworkAnimator = GetComponent<NetworkAnimator>();
        m_InterpolatePosition = gameObject.AddComponent<InterpolatePosition>();

        m_AnimationEventor.postThrowAway += ListenAnimationEventThrowAway;

        // detector
        crateDetector.doObtain = Obtain;
        damageDetector.doDamage = Hit;

        terrainDetector.postDetect = (Collision) =>
        {
            floating = false;
            terrainDetector.gameObject.SetActive(false);
        };
    }
Exemplo n.º 36
0
 void Awake()
 {
     anim = gameObject.GetComponent<NetworkAnimator>();
 }
Exemplo n.º 37
0
 void Start()
 {
     animator = GetComponent<Animator>();
     networkAnimator = GetComponent<NetworkAnimator>();
     navMeshAgent = GetComponent<NavMeshAgent>();
 }
	// Use this for initialization
	void Start ()
	{
		playerTran = transform;

		playerAni = GetComponent<NetworkAnimator>();
		charContr = GetComponent<CharacterController>();
		playerAudio = GetComponent<PlayerAudioController>();
		playerCam = GetComponent<PlayerCamera>();

		Transform childCam = playerTran.FindChild("camera");
		if(childCam)
		{
			childCam.GetComponent<Camera>().enabled = isLocalPlayer;
			childCam.GetComponent<AudioListener>().enabled = isLocalPlayer;
		}

		if (team != PlayerTeam.NotPicked)
		{
			Renderer r = GetComponent<Renderer>();
			if(r)
				r.material.color = team == PlayerTeam.TeamYellow ? Color.yellow : Color.blue;
			if (team == PlayerTeam.TeamBlue)
				for (int i = 0; i < charRend.Count; i++)
				{
					charRend[i].material = blueMat[i];
				}
				
			else
				for (int i = 0; i < charRend.Count; i++)
				{
					charRend[i].material = yellowMat[i];
				}
		}

		if (isLocalPlayer)
			localInstance = this;
	}
Exemplo n.º 39
0
 void Start()
 {
     // Only enable sound and camera for player if it's the local player
     if (isLocalPlayer) {
         // Disable and Enable Cameras / AudioListener
         try { GameObject.Find("Main Camera").SetActive(false); }
         catch { }
         characterCam.enabled = true;
         audioListener.enabled = true;
         //characterCam.transform.GetChild(0).GetComponent<Camera>().enabled = true;
         //m_MouseLook.Init(transform, characterCam.transform);
     }
     cam = characterCam.GetComponent<CharacterCamera>();
     stats = GetComponent<PlayerStats>();
     Speed = stats ? stats.speed : Speed; // Only use speed from playerStats if it is not null
     animNetwork = GetComponent<NetworkAnimator>();
     animLocal = GetComponent<Animator>();
     playerBehaviour = GetComponent<PlayerBehaviour>();
 }