コード例 #1
0
 void Start()
 {
     controller    = GetComponent <ThirdPersonController>();
     myRigidbody   = GetComponent <Rigidbody>();
     gunController = GetComponent <TPGunController>();
     viewCamera    = Camera.main;
 }
コード例 #2
0
    void OnEnable()
    {
        if( !cameraTransform && Camera.main )
            cameraTransform = Camera.main.transform;
        if( !cameraTransform )
        {
            Debug.Log( "Please assign a camera to the ThirdPersonCamera script." );
            enabled = false;
        }

        _target = transform;
        if( _target )
        {
            controller = _target.GetComponent<ThirdPersonController>();
        }

        if( controller )
        {
            CharacterController characterController = (CharacterController)_target.GetComponent<Collider>();
            centerOffset = characterController.bounds.center - _target.position;
            headOffset = centerOffset;
            headOffset.y = characterController.bounds.max.y - _target.position.y;
        }
        else
            Debug.Log( "Please assign a target to the camera that has a ThirdPersonController script attached." );


    }
コード例 #3
0
    void Awake()
    {
        cameraScript      = GetComponent <ThirdPersonCamera> ();
        controllerScript  = GetComponent <ThirdPersonController> ();
        specialAbbilities = GetComponent <PlayerSpecialAbbilities> ();

        if (photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            cameraScript.enabled      = true;
            controllerScript.enabled  = true;
            specialAbbilities.enabled = true;
        }
        else
        {
            cameraScript.enabled = false;
            cameraScript.cameraTransform.gameObject.SetActive(false);

            controllerScript.enabled        = true;
            controllerScript.isControllable = false;

            specialAbbilities.enabled        = true;
            specialAbbilities.isControllable = false;
        }

        gameObject.name = gameObject.name + photonView.viewID;
    }
コード例 #4
0
    void Start()
    {
        _player    = GameObject.FindGameObjectWithTag("Player");
        tpc        = _player.GetComponent <ThirdPersonController>();
        rb         = GetComponent <Rigidbody>();
        myCollider = GetComponent <BoxCollider>();

        myVoice = GetComponent <AudioSource>();

        walking.SetActive(false);
        sex.SetActive(false);
        fight.SetActive(false);

        origPos = transform.position;
        FindNewPoint();
        animalState = AnimalState.WALKING;

        idleTimer = idleTimerTotal;

        float randomClimax = Random.Range(-climaxTotal / 2, climaxTotal / 2);

        climaxTotal += randomClimax;

        int RandomSex   = Random.Range(0, sexy.Length);
        int RandomFight = Random.Range(0, fighting.Length);

        sexxer  = sexy[RandomSex];
        fighter = fighting[RandomFight];
    }
コード例 #5
0
 void Start()
 {
     buttonInterface = GameManager.instance.altOS.gameObject;
     altweapons      = GameManager.instance.altWeapons;
     playerB         = GameManager.instance.playerB;
     tpc             = GameManager.instance.tpc;
 }
コード例 #6
0
ファイル: UpgradeGUI.cs プロジェクト: catudy/BrainZ-GainZ
 void Awake()
 {
     playerState = GameObject.Find("Player").GetComponentInChildren<PlayerState>();
     gameState = GameObject.Find("GameController").GetComponentInChildren<GameState>();
     weaponSystem = GameObject.Find("Player").GetComponentInChildren<WeaponSystem>();
     thirdPersonController = GameObject.Find("Player").GetComponentInChildren<ThirdPersonController>();
 }
コード例 #7
0
ファイル: InGame.cs プロジェクト: hompoth/FlingWhale
	public void Awake()
	{
		time = Time.time;
		Loaded = false;
		mGen = GetComponent<MapGeneration> (); //new MapGeneration();
		pFind = GetComponent<AStar> ();
		photonView = GetComponent<PhotonView> ();
		seed = 0;
		if (PhotonNetwork.isMasterClient) {
			seed = Random.seed;
			for (int i = -4; i <= 4; ++i) {
				for(int j = -4; j <= 4; ++j){
					mGen.GenerateBlock (i, j, seed, 0, 0);
				}
			}
			mGen.CreateGrid(0, 0);
			Loaded = true;	
			lastX = 0;
			lastY = 0;
		}
		
		// in case we started this demo with the wrong scene being active, simply load the menu scene
		if (!PhotonNetwork.connected)
		{
			Application.LoadLevel(Menu.SceneNameMenu);
			return;
		}
		// we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate
		playerObject = PhotonNetwork.Instantiate(this.playerPrefab.name, transform.position, Quaternion.identity, 0);
		playerController = playerObject.GetComponent<ThirdPersonController> ();
	}
コード例 #8
0
 private void OnEnable()
 {
     if (!this.cameraTransform && Camera.main)
     {
         this.cameraTransform = Camera.main.transform;
     }
     if (!this.cameraTransform)
     {
         Debug.Log("Please assign a camera to the ThirdPersonCamera script.");
         base.enabled = false;
     }
     this.m_CameraTransformCamera = this.cameraTransform.GetComponent <Camera>();
     this._target = base.transform;
     if (this._target)
     {
         this.controller = this._target.GetComponent <ThirdPersonController>();
     }
     if (this.controller)
     {
         CharacterController characterController = (CharacterController)this._target.GetComponent <Collider>();
         this.centerOffset = characterController.bounds.center - this._target.position;
         this.headOffset   = this.centerOffset;
         this.headOffset.y = characterController.bounds.max.y - this._target.position.y;
     }
     else
     {
         Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached.");
     }
     this.Cut(this._target, this.centerOffset);
 }
コード例 #9
0
 public override void Awake()
 {
     if (!this.cameraTransform && Camera.main)
     {
         this.cameraTransform = Camera.main.transform;
     }
     if (!this.cameraTransform)
     {
         Debug.Log("Please assign a camera to the ThirdPersonCamera script.");
         this.enabled = false;
     }
     this._target = this.transform;
     if (this._target)
     {
         this.controller = (ThirdPersonController)this._target.GetComponent(typeof(ThirdPersonController));
     }
     if (this.controller)
     {
         CharacterController characterController = (CharacterController)this._target.collider;
         this.centerOffset = characterController.bounds.center - this._target.position;
         this.headOffset   = this.centerOffset;
         this.headOffset.y = characterController.bounds.max.y - this._target.position.y;
     }
     else
     {
         Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached.");
     }
     this.Cut(this._target, this.centerOffset);
 }
コード例 #10
0
    void OnEnable()
    {
        if( !this.cameraTransform && Camera.main )
            this.cameraTransform = Camera.main.transform;
        if( !this.cameraTransform )
        {
            Debug.Log( "Please assign a camera to the ThirdPersonCamera script." );
            this.enabled = false;
        }

        this.m_CameraTransformCamera = this.cameraTransform.GetComponent<Camera>();

        this._target = this.transform;
        if(this._target )
        {
            this.controller = this._target.GetComponent<ThirdPersonController>();
        }

        if(this.controller )
        {
            CharacterController characterController = (CharacterController)this._target.GetComponent<Collider>();
            this.centerOffset = characterController.bounds.center - this._target.position;
            this.headOffset = this.centerOffset;
            this.headOffset.y = characterController.bounds.max.y - this._target.position.y;
        }
        else
            Debug.Log( "Please assign a target to the camera that has a ThirdPersonController script attached." );

        this.Cut(this._target, this.centerOffset );
    }
コード例 #11
0
    void Start()
    {
        // store the Animator component
        animator = GetComponent<Animator>();
        tpController = GetComponent<ThirdPersonController>();
        // find character chest and hips
        characterChest = animator.GetBoneTransform(HumanBodyBones.Chest);
        characterHips = animator.GetBoneTransform(HumanBodyBones.Hips);

        // set all RigidBodies to kinematic so that they can be controlled with Mecanim
        // and there will be no glitches when transitioning to a ragdoll
        setKinematic(true);
        setCollider(true);

        // find all the transforms in the character, assuming that this script is attached to the root
        Component[] components = GetComponentsInChildren(typeof(Transform));

        // for each of the transforms, create a BodyPart instance and store the transform 
        foreach (Component c in components)
        {
            BodyPart bodyPart = new BodyPart();
            bodyPart.transform = c as Transform;
            bodyParts.Add(bodyPart);
        }
    }
コード例 #12
0
    public void StartScene(bool instrucciones)
    {
        int numMonedas = PlayerPrefs.GetInt("Monedas");

        if (numMonedas != 0 && instrucciones)
        {
            foreach (GameObject aux in GameObject.FindGameObjectsWithTag("Masita"))
            {
                aux.GetComponent <Moneditas>().valor = 0;
            }
        }

        nuevoTalento      = numMonedas >= 10;
        Screen.showCursor = false;

        pause = false;

        controlador                = GameObject.Find("Player").GetComponent <ThirdPersonController>();
        monedas                    = GameObject.Find("Interfaz_Monedas").guiText;
        interfazTalentos           = GameObject.Find("Interfaz_Talentos").guiTexture;
        monedas.text               = "Masa: " + numMonedas;
        controlador.isControllable = true;

        talentosController = new TalentosController();
    }
コード例 #13
0
ファイル: ThirdPersonCamera.cs プロジェクト: patel22p/dorumon
    void OnEnable()
    {
        if (!cameraTransform && Camera.main)
        {
            cameraTransform = Camera.main.transform;
        }
        if (!cameraTransform)
        {
            Debug.Log("Please assign a camera to the ThirdPersonCamera script.");
            enabled = false;
        }


        _target = transform;
        if (_target)
        {
            controller = _target.GetComponent <ThirdPersonController>();
        }

        if (controller)
        {
            CharacterController characterController = (CharacterController)_target.collider;
            centerOffset = characterController.bounds.center - _target.position;
            headOffset   = centerOffset;
            headOffset.y = characterController.bounds.max.y - _target.position.y;
        }
        else
        {
            Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached.");
        }


        Cut(_target, centerOffset);
    }
コード例 #14
0
    // Use this for initialization
    void Start()
    {
        controls    = GetComponent <ThirdPersonController> ();
        weapons     = GetComponentsInChildren <Weapon> ();
        currentLife = maxLife;
        damageSmoke = GetComponentInChildren <ParticleSystem> ();
//		sliderLife.value = currentLife;
    }
コード例 #15
0
 public void OnInteracted(ThirdPersonController player)
 {
     focusOn = player.transform;
     if (layer == InteractiveLayer.NPC)
     {
         this.transform.parent.localRotation = Quaternion.LookRotation(focusOn.position - transform.position, Vector3.up);
     }
 }
コード例 #16
0
 void Start()
 {
     enemyB       = GetComponent <EnemyBehaviour>();
     sManager     = GameManager.instance.sManager;
     tpc          = GameManager.instance.tpc;
     altWeapons   = GameManager.instance.altWeapons;
     healthScript = GameManager.instance.health;
     shield       = GameObject.FindGameObjectWithTag("Shield").GetComponent <Animator>();
 }
コード例 #17
0
ファイル: PlayerPotionHandler.cs プロジェクト: rbVessal/Chase
	// Use this for initialization
	void Start () {
	
		// gets the force
		forceObj = GameObject.Find("Force");
		theForce = forceObj.GetComponent("Force") as Force;
		
		// gets the player controller
		playerController = this.GetComponent("ThirdPersonController") as ThirdPersonController;
	}
コード例 #18
0
 public virtual void UpdateHUD(ThirdPersonController cc)
 {
     //  UpdateDebugWindow(cc);
     UpdateSliders(cc);
     //   ChangeInputDisplay();
     ShowDamageSprite();
     //  FadeEffect();
     //CheckActionTrigger(cc);
 }
コード例 #19
0
ファイル: PlayerPotionHandler.cs プロジェクト: stackm/Chase
    // Use this for initialization
    void Start()
    {
        // gets the force
        forceObj = GameObject.Find("Force");
        theForce = forceObj.GetComponent("Force") as Force;

        // gets the player controller
        playerController = this.GetComponent("ThirdPersonController") as ThirdPersonController;
    }
コード例 #20
0
 private void Awake()
 {
     _audioSource         = GetComponent <AudioSource>();
     _ps                  = gameObject.GetComponentInChildren <ParticleSystem>();
     _player              = FindObjectOfType <ThirdPersonController>();
     _parent              = transform.parent;
     _messageText         = GameObject.FindWithTag("MessageText").gameObject.GetComponent <TextMeshProUGUI>();
     _messageBoxAnimation = _messageText.transform.parent.gameObject.GetComponent <MessageBoxAnimation>();
 }
コード例 #21
0
 private void Start()
 {
     character        = GetComponent <ThirdPersonController>();
     oxygen           = GetComponent <Oxygen>();
     CurrentHeartRate = 60;
     UIManager.HeartRateMonitor.SetHeartRate(CurrentHeartRate);
     targetHeartRate = relaxedTarget;
     isRelaxed       = true;
 }
コード例 #22
0
    private void OnTriggerEnter(Collider other)
    {
        ThirdPersonController character = other.GetComponent <ThirdPersonController>();

        if (character)
        {
            GameManager.Instance.PassCheckpoint(this);
        }
    }
コード例 #23
0
    void Awake()
    {
        CharacterController = GetComponent("CharacterController") as CharacterController;
        Instance = this;
        MoveVector = transform.TransformDirection(Vector3.forward);

        /*Set Main Camera to look at Player*/
        ThirdPersonCamera.UseExistingOrCreateNewMainCamera();
    }
コード例 #24
0
    public virtual void Update()
    {
        ThirdPersonController playerController = (ThirdPersonController)this.GetComponent(typeof(ThirdPersonController));
        float currentSpeed = playerController.GetSpeed();

        if (currentSpeed > playerController.walkSpeed)
        {
            this.anim.CrossFade("run");
            this.anim.Blend("jumpland", 0);
        }
        else
        {
            if (currentSpeed > 0.1f)
            {
                this.anim.CrossFade("walk");
                this.anim.Blend("jumpland", 0);
            }
            else
            {
                this.anim.Blend("walk", 0f, 0.3f);
                this.anim.Blend("run", 0f, 0.3f);
                this.anim.Blend("run", 0f, 0.3f);
            }
        }
        this.anim["run"].normalizedSpeed  = this.runSpeedScale;
        this.anim["walk"].normalizedSpeed = this.walkSpeedScale;
        if (playerController.IsJumping())
        {
            if (playerController.IsControlledDescent())
            {
                this.anim.CrossFade("jetpackjump", 0.2f);
            }
            else
            {
                if (playerController.HasJumpReachedApex())
                {
                    this.anim.CrossFade("jumpfall", 0.2f);
                }
                else
                {
                    this.anim.CrossFade("jump", 0.2f);
                }
            }
        }
        else
        {
            if (!playerController.IsGroundedWithTimeout())
            {
                this.anim.CrossFade("ledgefall", 0.2f);
            }
            else
            {
                this.anim.Blend("ledgefall", 0f, 0.2f);
            }
        }
    }
コード例 #25
0
 void OnTriggerEnter(Collider c)
 {
     if (c.gameObject.tag == "Player")
     {
         Debug.Log("Player timeline trigger");
         timeline.Play();
         playerController = c.gameObject.GetComponent <ThirdPersonController>();
         playerController.Disable(); // Disable player movements
     }
 }
コード例 #26
0
    void Start()
    {
        tpc = GameObject.FindGameObjectWithTag("Player").GetComponent <ThirdPersonController>();
        rb  = GetComponent <Rigidbody>();

        // get in boat UI
        symbol         = GameObject.FindGameObjectWithTag("Symbol").GetComponent <Image>(); //searches for InteractSymbol
        symbolAnimator = symbol.GetComponent <AnimateUI>();
        rb.isKinematic = true;
    }
コード例 #27
0
    void Start()
    {
        _playerScript = player.GetComponent <ThirdPersonController>();
        _insideTower  = _playerScript.InsideTower;

        _initAngle = _currAngle = GetAngle();

        _headRenderer   = firstPersonView.GetComponent <MeshRenderer>();
        _targetPosition = Vector3.zero;
    }
コード例 #28
0
    void Start()
    {
        CameraTarget = transform.parent;
        controller   = ThirdPersonController.Instance;
        Vector3 Angles = transform.eulerAngles;

        x = Angles.x;
        y = Angles.y;
        desireDistance = 9f;
    }
コード例 #29
0
    public virtual void Update()
    {
        ThirdPersonController controller = (ThirdPersonController)this.GetComponent(typeof(ThirdPersonController));

        if (((!this.busy && Input.GetButtonDown("Fire1")) && controller.IsGroundedWithTimeout()) && !controller.IsMoving())
        {
            this.SendMessage("DidPunch");
            this.busy = true;
        }
    }
コード例 #30
0
ファイル: GameScene.cs プロジェクト: wuhuolong/fps-demo
    void ComponentStart()
    {
        controller = GetComponent <ThirdPersonController>();
        int     uid = Player.Instance.Uid;
        Vector2 pos = Player.Instance.Pos;

        mainPlayer = ThirdPersonManager.Instance.CreateCharacter(uid, pos);
        controller.Attach(mainPlayer);
        Debug.Log("GameScene MainPlayer:" + pos);
    }
コード例 #31
0
    public virtual IEnumerator Slam()
    {
        this.anim.CrossFade("buttstomp", 0.2f);
        ThirdPersonController playerController = (ThirdPersonController)this.GetComponent(typeof(ThirdPersonController));

        while (!playerController.IsGrounded())
        {
            yield return(null);
        }
        this.anim.Blend("buttstomp", 0, 0);
    }
コード例 #32
0
    void Start()
    {
        tpc = GameManager.instance.tpc;
        cpt = GameManager.instance.cpt;

        playerTrans        = tpc.transform;
        transform.position = playerTrans.position + offset;

        cameraTargetDefault.position = playerTrans.position;
        cameraState = CameraState.Default;
    }
コード例 #33
0
 void Start()
 {
     tpc                  = GameManager.instance.tpc;
     altOS                = GameManager.instance.altOS;
     hookshot             = GetComponent <HookshotController>();
     hookshot.altweapons  = this;
     boomerang            = GetComponent <BoomerangController>();
     boomerang.altweapons = this;
     bow                  = GetComponent <BowController>();
     bow.altweapons       = this;
 }
コード例 #34
0
 // public cinem;
 void Awake()
 {
     m                  = this;
     anim               = transform.GetChild(1).GetComponent <Animator>();
     WalkInitSpeed      = walkSpeed;
     rb                 = GetComponent <Rigidbody>();
     controller         = GetComponent <CharacterController>();
     moveDirection      = transform.TransformDirection(Vector3.forward);
     hit_transform_keep = new GameObject().transform;
     hit_transform_keep.SetParent(transform);
     hit_transform_keep.transform.localRotation = Quaternion.identity;
 }
コード例 #35
0
    public void DetectFirstPersonCharacter(ThirdPersonController thirdPersonCharacter)
    {
        detectedPlayer          = true;
        _thirdPersonCharacter   = thirdPersonCharacter;
        rendererParent.rotation = Quaternion.Euler(0, currentShootDirection == ShootDirection.Right ? rightRotation : leftRotation, 0);

        if (shootFrequenceSystem.IsStopped)
        {
            StartShooting();
            shootFrequenceSystem.Resume();
        }
    }
コード例 #36
0
ファイル: Jumppad.cs プロジェクト: prefrontalcortex/Lerpz
    public virtual void OnTriggerEnter(Collider col)
    {
        ThirdPersonController controller = (ThirdPersonController)col.GetComponent(typeof(ThirdPersonController));

        if (controller != null)
        {
            if (this.GetComponent <AudioSource>())
            {
                this.GetComponent <AudioSource>().Play();
            }
            controller.SuperJump(this.jumpHeight);
        }
    }
コード例 #37
0
    public override void OnTriggerEnter(Collider col)
    {
        ThirdPersonController thirdPersonController = (ThirdPersonController)col.GetComponent(typeof(ThirdPersonController));

        if (thirdPersonController != null)
        {
            if (this.get_audio())
            {
                this.get_audio().Play();
            }
            thirdPersonController.SuperJump(this.jumpHeight);
        }
    }
コード例 #38
0
    void Start ()
{
		currentStatus = AnimationStatus.Idle;

		
	// By default loop all animations
   // animationGameObject.animation.wrapMode = WrapMode.Loop;

    animationGameObject.animation["run"].layer = -1;
    animationGameObject.animation["run"].wrapMode = WrapMode.Loop;
    animationGameObject.animation["walk"].layer = -1;
    animationGameObject.animation["walk"].wrapMode = WrapMode.Loop;
    animationGameObject.animation["idle"].layer = -2;
    animationGameObject.animation.SyncLayer(-1);

    animationGameObject.animation["fly"].layer = 1;
    animationGameObject.animation["fly"].wrapMode = WrapMode.ClampForever;

   // animationGameObject.animation["elevate"].layer = 1;
   // animationGameObject.animation["lower"].layer = 1;


    animationGameObject.animation["idle"].wrapMode = WrapMode.Loop;

	// The jump animation is clamped and overrides all others
    animationGameObject.animation["jump"].layer = 10;
    animationGameObject.animation["jump"].wrapMode = WrapMode.ClampForever;

    animationGameObject.animation["fall"].layer = 10;
    animationGameObject.animation["fall"].wrapMode = WrapMode.Loop;

    animationGameObject.animation["land"].layer = 10;
    animationGameObject.animation["land"].wrapMode = WrapMode.Once;

    animationGameObject.animation["fallHit"].layer = 10;
    animationGameObject.animation["fallHit"].wrapMode = WrapMode.Once;




	// We are in full control here - don't let any other animations play when we start
    animationGameObject.animation.Stop();
    animationGameObject.animation.Play("idle");


    characterController = GetComponent<ThirdPersonController>();
    flyingController = GetComponent<ThirdPersonFlyingController>();
    

}
コード例 #39
0
 // Use this for initialization
 void Start()
 {
     shooting = false;
     player = GameObject.FindGameObjectWithTag("Player");
     person = player.GetComponent<ThirdPersonController>();
     animator = GetComponent<Animator>();
     col = GetComponent<CapsuleCollider>();
     activeBullet = GameObject.Find("bullet");
     activeBullet.SetActive(false);
     ak = GameObject.Find("Ak-47Enemy");
     render = GetComponentInChildren<LineRenderer>();
     //CollectShootableBodyParts(player.transform);
     //go.transform.position = new Vector3();
 }
コード例 #40
0
	void Start ()
	// Verify setup, configure
	{
		Setup ();
			// Retry setup if references were cleared post-add
			
		if (VerifySetup ())
		{
			controller = GetComponent<ThirdPersonController> ();
			controller.onJump += OnJump;
				// Have OnJump invoked when the ThirdPersonController starts a jump
			currentRotation = 0.0f;
			lastRootForward = root.forward;
		}
	}
コード例 #41
0
    void Awake() {

        characterController = GetComponent<ThirdPersonController>();
        controller = GetComponent<CharacterController>();

        moveDirection = transform.TransformDirection(Vector3.forward);
		
		
		
        //assign to Component in main camera
       // normalCameraSmoothFollow = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<PlayerCamera>();
        camManager = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraManager>();
		playerManager = GetComponent<PlayerManager>();
		
		Screen.lockCursor = true;
		
    }
コード例 #42
0
    void SetCameraTarget(Transform t)
    {
        target = t;

        if (target != null)
        {
            if (target.GetComponent<ThirdPersonController>())
            {
                charController = target.GetComponent<ThirdPersonController>();
            }
            else
            {
                Debug.LogError("The camaera target needs a characterController");
            }
        } else
            Debug.LogError ("Your camera needs a target");
    }
コード例 #43
0
    // Use this for initialization
    void Start()
    {
		thirdPersonController = GetComponent<ThirdPersonController>();
        thirdPersonFlyingController = GetComponent<ThirdPersonFlyingController>();
		
		mouseOrbit = GameObject.Find("LookTarget").GetComponent<MouseOrbit>();
        mouseAimFlying = GameObject.Find("LookTarget").GetComponent<MouseFlying>();

		//playerLookTarget = GetComponent<PlayerLookTarget>();
		headLookController = GetComponent<HeadLookController>();
				
		
		_lookDirection = thirdPersonController.MoveDirection();
		_inAirVelocity = 0.0f;

        _health = 100;
		
		_catsCollected = 0;
    }
コード例 #44
0
ファイル: ThirdPersonNetwork.cs プロジェクト: na2424/ChatUni
    void Awake()
    {
        cameraScript = GetComponent<ThirdPersonCamera>();
        controllerScript = GetComponent<ThirdPersonController>();
        if (photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            cameraScript.enabled = true;
            controllerScript.enabled = true;
        }
        else
        {           
            cameraScript.enabled = false;

            controllerScript.enabled = true;
            controllerScript.isControllable = false;
        }

        gameObject.name = gameObject.name + photonView.viewID;
    }
コード例 #45
0
    void Awake()
    {
        this.cameraScript = this.GetComponent<ThirdPersonCamera>();
        this.controllerScript = this.GetComponent<ThirdPersonController>();

         if (this.photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            this.cameraScript.enabled = true;
            this.controllerScript.enabled = true;
        }
        else
        {
            this.cameraScript.enabled = false;

            this.controllerScript.enabled = true;
            this.controllerScript.isControllable = false;
        }

        this.gameObject.name = this.gameObject.name + this.photonView.viewID;
    }
コード例 #46
0
ファイル: CharacterAI.cs プロジェクト: bwrsandman/Stream-Game
 void Start()
 {
     timeActions = GetComponent<TimeActions>();
     master = GetComponent<ThirdPersonController>();
     playerTransform = GameObject.FindWithTag("Player").transform;
 }
コード例 #47
0
 void Start()
 {
     controller = GetComponent <ThirdPersonController>();
 }
コード例 #48
0
 /// <summary>
 /// Initializes the custom components.
 /// </summary>
 private void InitializeCustomComponents()
 {
     _thirdPersonController = personController.GetComponent<ThirdPersonController>();
     _thirdPersonCameraController = personController.GetComponent<ThirdPersonCamera>();
     _flyScan = personController.GetComponent<FlyScan>();
     _characterMotor = personController.GetComponent<CharacterMotor>();
     _fpsInputController = personController.GetComponent<FPSInputController>();
     _rotationConstraint = eyesCamera.GetComponent<RotationConstraint>();
     _myMouseLook = personController.GetComponent<MyMouseLook>();
 }
コード例 #49
0
    void Start()
    {
        players = new Dictionary<string, ChickenPlayer>();

        if (Player) {

            player_controller = Player.GetComponent<ThirdPersonController>();
            camera_controller = Player.GetComponent<ThirdPersonCamera>();

            player_last_position = Player.transform.position;
            player_last_rotation = Player.transform.eulerAngles.y;
            player_last_state = player_controller.GetState();
        }
    }
コード例 #50
0
    private void Awake()
    {
        var characterController = Target.GetComponent<CharacterController>();
        if (characterController != null)
        {
            _centerOffset = characterController.bounds.center - Target.position;
            _headOffset = _centerOffset;
            _headOffset.y = characterController.bounds.max.y - Target.position.y;
        }

        if (Target != null)
        {
            _controller = Target.GetComponent<ThirdPersonController>();
        }

        if (_controller == null)
            Debug.Log("Please assign a target to the camera that has a Third Person Controller script component.");
    }
コード例 #51
0
ファイル: Player.cs プロジェクト: darwikey/ProjetRutabaga
    // When the player spawn
    public virtual void Start()
    {
        _health = 100.0f;

        _tm = GameObject.Find("TeamManager").GetComponent<TeamManager>();
        _obstacleManager = GameObject.Find("ObstacleManager").GetComponent<ObstacleManager>();
        _tpc = GetComponent<ThirdPersonController>();

        // Minimap icon
        if (_minimapIcon == null) {
            _minimapIcon = GameObject.CreatePrimitive (PrimitiveType.Quad);
            _minimapIcon.name = "Icon";
            _minimapIcon.GetComponent<MeshCollider> ().enabled = false;
            _minimapIcon.transform.SetParent (transform);
            _minimapIcon.transform.localPosition = new Vector3 (0.0f, 1.5f, 0.0f);
            _minimapIcon.transform.rotation = Quaternion.Euler (90.0f, 0.0f, 0.0f);
            _minimapIcon.transform.localScale = 9.0f * Vector3.one;
            _minimapIcon.layer = 10;

            if (team == 1) {
                _minimapIcon.GetComponent<Renderer> ().material = Resources.Load ("team1Minimap") as Material;
                foreach (Transform child in transform)
                {
                    if (child.name == "Bip001")
                    {
                        child.GetChild(0).GetComponent<SkinnedMeshRenderer>().material = Resources.Load("constructor_done") as Material;
                    }
                }
            } else {
                _minimapIcon.GetComponent<Renderer> ().material = Resources.Load ("team2Minimap") as Material;
                foreach (Transform child in transform)
                {
                    if (child.name == "Bip001")
                    {
                        child.GetChild(0).GetComponent<SkinnedMeshRenderer>().material = Resources.Load("constructor_done2") as Material;
                    }
                }
            }
        }

        // Fog mask
        if (_team == 1 && _fogMask == null)
        {
            _fogMask = GameObject.CreatePrimitive (PrimitiveType.Quad);
            _fogMask.name = "FogMask";
            _fogMask.GetComponent<MeshCollider> ().enabled = false;
            _fogMask.transform.SetParent (transform);
            _fogMask.transform.localPosition = new Vector3 (0.0f, 1.5f, 0.0f);
            _fogMask.transform.rotation = Quaternion.Euler (90.0f, 0.0f, 0.0f);
            _fogMask.transform.localScale = 16.0f * Vector3.one;
            _fogMask.layer = 9;
            _fogMask.GetComponent<Renderer>().material = Resources.Load ("FogMaskMat") as Material;
        }

        // grenade
        _grenadePrefab = Resources.Load("Grenade") as GameObject;

        if (!isMainPlayer())
        {
            AI_Start();
        }
    }
コード例 #52
0
    void DidChangeTarget()
    {
        if (target) {
            Collider characterController = target.collider;
            if (characterController) {
                centerOffset = characterController.bounds.center - target.position;
                headOffset = centerOffset;
                headOffset.y = characterController.bounds.max.y - target.position.y;
            }

            if (target) {
                controller = target.GetComponent<ThirdPersonController> ();
            }

            if (!controller)
                Debug.Log ("Please assign a target to the camera that has a super mario controller.");
        }
    }
コード例 #53
0
 void Awake()
 {
     combat = (Combat)FindObjectOfType(typeof(Combat));
     tps = (ThirdPersonController)FindObjectOfType(typeof(ThirdPersonController));
 }
コード例 #54
0
    void Awake()
    {
        controllerScript = GetComponent<ThirdPersonController>();

         if (photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            SendMessage("SetIsControl", true, SendMessageOptions.DontRequireReceiver);
        }
        else
        {
            cameraController.active = false;
            cameraController.transform.FindChild("MainCamera").active = false;
            cameraController.transform.FindChild("MainCamera").FindChild("GunCamera").active = false;
            SendMessage("SetIsControl", false, SendMessageOptions.DontRequireReceiver);
            controllerScript.isControllable = false;
            gameObject.tag = "OtherPlayer";
        }

        gameObject.name = gameObject.name + photonView.viewID;
    }
コード例 #55
0
    void Awake()
    {
        if(!cameraTransform && Camera.main)
            cameraTransform = Camera.main.transform;

        if(!cameraTransform) {
            //Debug.Log("Please assign a camera to the ThirdPersonCamera script.");
            enabled = false;
        }

        minimapTransform = GameObject.FindGameObjectWithTag ("MinimapCamera").GetComponent<Transform> ();
        minimapCamera = minimapTransform.camera;
        _target = transform;
        _pawn = GetComponent<Pawn> ();
        if (_target)
        {
            controller = _target.GetComponent<ThirdPersonController>();
        }

        if (controller) {
                        CapsuleCollider characterController = _target.GetComponent<CapsuleCollider> ();
                        centerOffset = characterController.bounds.center - _target.position;
                        headOffset = centerOffset;
                        headOffset.y = characterController.bounds.max.y - _target.position.y;
        } else {
                        //Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached.");

        }
        Cut(_target, centerOffset);
    }
コード例 #56
0
    void Awake()
    {
        cameraScript = GetComponent<ThirdPersonCamera>();
        controllerScript = GetComponent<ThirdPersonController>();

    }
コード例 #57
0
 void Awake()
 {
     tpc = GetComponent<ThirdPersonController>();
     particles = this.GetComponentsInChildren<ParticleEmitter>();
 }
コード例 #58
0
 public WolfChasePlayer(WolfAIFSMSystem fsm, GameObject npc, GameObject pc)
 {
     stateID = WolfAIStateID.ChasePlayer;
     this.npc = npc;
     this.pc = pc;
     pcScript = pc.GetComponent<ThirdPersonController>();
     anim = npc.GetComponent<Animator>();
     this.fsm = fsm;
 }
コード例 #59
0
    // Use this for initialization
    void Start()
    {
        alive = true;
        attackRange = 1f;

        attacking = false;
        ParticleSystem ps = GetComponentInChildren<ParticleSystem>();
        ps.startColor = playerChemicals.getChemicals();
        GetComponentInChildren<SpriteRenderer> ().color =
            new Color(playerChemicals.getChemicals ().r + 0.6f,
                      playerChemicals.getChemicals ().g + 0.6f,
                      playerChemicals.getChemicals ().b + 0.6f);

        health = maxHealth;
        controller = GetComponent<ThirdPersonController>();
        gameOverDisplay = GameObject.Find ("GameOverDisplay");
    }
コード例 #60
0
    private void Start()
    {
        healthBar = Resources.Load("WhiteSquare") as Texture;
        stats = GetComponent<PlayerStats>();
        inputManager = GetComponent<PlayerInputManager>();
        controller = GetComponent<ThirdPersonController>();

        elements["HealthBackground"] = Resources.Load("GUI/HealthBackground") as Texture2D;
        elements["HealthForeground"] = Resources.Load("GUI/HealthActive") as Texture2D;
        elements["ManaBackground"] = Resources.Load("GUI/ManaBackground") as Texture2D;
        elements["ManaForeground"] = Resources.Load("GUI/ManaActive") as Texture2D;
        elements["StaminaBackground"] = Resources.Load("GUI/StamBackground") as Texture2D;
        elements["StaminaForeground"] = Resources.Load("GUI/StamActive") as Texture2D;

        elements["ActionSocketBezel"] = Resources.Load("GUI/ActionSocketBezel") as Texture2D;
        elements["ActionBackground"] = Resources.Load("GUI/ActionBackground") as Texture2D;

        elements["CastRed"] = Resources.Load("SpellIcons/CastRed") as Texture2D;
        elements["OneHandedRed"] = Resources.Load("GUI/OneHandedRed") as Texture2D;

        elements["SpellcastForeground"] = Resources.Load("GUI/SpellcastForeground") as Texture2D;

        elements["Button"] = Resources.Load("GUI/Button") as Texture2D;
        elements["Gold"] = Resources.Load("GUI/STOLEN_GoldCoin") as Texture2D;

        StartCoroutine(LoadNetworkRequiredComponents());

        skin = Util.ISEGUISkin;
    }