private bool UpdateLightsaberAnchor() { if (mLightSaberHolding) { if (mHolsterTouching != null) { mLightSaberHolding.SetAnchor(mHolsterTouching); mLightSaberHolding = null; mModel.SetActive(true); return(true); } } else { if (mLightsaberTouching != null) { mLightSaberHolding = mLightsaberTouching.GetComponentInParent <LightsaberController>(); mLightSaberHolding.SetAnchor(gameObject); mModel.SetActive(false); return(true); } } return(false); }
void Awake() { this._player = this.gameObject.GetComponent <Player>(); this._playerMovement = this.gameObject.GetComponent <PlayerMovement>(); this._audioManager = FindObjectsOfType <AudioManager>()[0]; this._lightsaberController = this._player.GetComponentInChildren <LightsaberController>(); this._animator = this._player.gameObject.GetComponent <Animator>(); }
private void Awake() { this._input = new PlayerInput(); this._player = this.gameObject.GetComponent <Player>(); this._playerMovement = this.gameObject.GetComponent <PlayerMovement>(); this._lightsaberController = this.gameObject.GetComponentInChildren <LightsaberController>(); this.InputTaker(); }
void Start() { this._player = this.gameObject.GetComponent <Player>(); this._lightsaberController = this._player.GetComponentInChildren <LightsaberController>(); this._animator = this.gameObject.GetComponent <Animator>(); this._rg = this.gameObject.GetComponent <Rigidbody>(); this.CanDash = true; this.CanDodge = true; }
void Awake() { this.Health = 100f; Cursor.lockState = CursorLockMode.Locked; this.IsTargetAcquired = false; this.IsConsoleActive = false; this.ArtificialGravity = false; this._animator = this.gameObject.GetComponent <Animator>(); this._rg = this.gameObject.GetComponent <Rigidbody>(); this._shootAt = UnityHelper.GetChildWithName(this.gameObject, "ShootAt").transform; this._playerMovement = this.gameObject.GetComponent <PlayerMovement>(); this._lightsaberController = this.gameObject.GetComponentInChildren <LightsaberController>(); }
private void OnTriggerEnter(Collider other) { if (other.gameObject != this._blaster && !other.gameObject.CompareTag("Player") && other.gameObject.GetComponent <Bolt>() == null) { StartCoroutine(this.WaitBeforeDeath(0f)); } if (other.gameObject.CompareTag("Player")) { Player player = other.gameObject.GetComponent <Player>(); LightsaberController lightsaberController = player.GetLightsaberController(); if (lightsaberController.IsBlocking) { Vector3 rotEulers; if (Time.time - lightsaberController.BlockingStarTime < LightsaberController.TIME_TO_PARRY) { Vector3 wielderPos = this._blaster.GetWielder().GetShootAt().position; Vector3 lookAtPos = new Vector3(wielderPos.x, wielderPos.y, wielderPos.z); this.transform.LookAt(lookAtPos, Vector3.up); this._isParied = true; } else { rotEulers = this.GetXAndYForDeflection(); this.transform.Rotate(rotEulers); } } else { player.TakeDamage(this.Damage); StartCoroutine(this.WaitBeforeDeath(.05f)); } } }
private void Awake() { this.Player = this.gameObject.GetComponent <Player>(); this.PlayerMovement = this.gameObject.GetComponent <PlayerMovement>(); this.LightsaberController = this.Player.GetComponentInChildren <LightsaberController>(); }