private void Start() { player = gameObject.GetComponentInParent <PlayerController>(); skillName = "Attack"; skillInfo = "basic attack"; skillCooldown = attackCooldown; playerLayer = 1 << LayerMask.NameToLayer("Player"); charges = gameObject.AddComponent <Charges>(); charges.SetCharges(maxCharges, chargeTime); combo = new Combo(); attackIcon = player.cooldownUiController.attackIcon; darkMask = attackIcon.darkMask.GetComponent <Image>(); }
void Init() { float startXPos = Screen.width * 1 / 8 + _cooldownUIPrefab.GetComponent <RectTransform>().sizeDelta.x; float width = Screen.width * 3 / 4; float spacing = width / _abilities.Length - 1; float yPos = Screen.height * 1 / 12; for (uint i = 0; i < _abilities.Length; i++) { GameObject cdUIObj = Instantiate(_cooldownUIPrefab, new Vector3(startXPos + i * spacing, yPos), new Quaternion(), transform); CooldownUI cdUI = cdUIObj.GetComponent <CooldownUI> (); cdUI.ability = _abilities [i]; } }
protected void Awake() { Instance = this; }
// find aggregated objects void Awake() { #region check aggrigated classes/components if (input == null) { input = GetComponent<PlayerInput>(); } if (movement == null || myProperties.myMovement == null) { movement = GetComponent<PlayerMovement>(); movement.myOwner = this; myProperties.myMovement = movement; } if (playerAnimation == null) { playerAnimation = GetComponent<PlayerAnimation>(); } if (playerSounds == null) { playerSounds = transform.Find("Sounds").GetComponent<PlayerSounds>(); } if (circleGesture == null) { circleGesture = GetComponent<CircleGestureReader>(); } if (updateControllers == null || updateControllers.Length == 0) { updateControllers = GetComponentsInChildren<UpdateController>(); } if (punchCircle == null) { punchCircle = transform.Find("PunchUI").GetComponent<PunchCircle>(); } if (dashCircle == null) { dashCircle = transform.Find("Geometry/DashUI").GetComponent<CooldownUI>(); } if (stompCircle == null) { stompCircle = transform.Find("StompUI").GetComponent<CooldownUI>(); } if (col == null) { col = geometry.GetComponent<Collider>(); } // parent of the actual player model if (geometry == null) { geometry = transform.Find("Geometry"); } // get Animator from player geometry if (geometry != null && anim == null) { anim = geometry.GetComponentInChildren<Animator>(); } // get punch animation event if (anim != null && animEvents == null) { animEvents = anim.GetComponent<LivingAnimationEvents>(); } if (this.myProperties.myPerception == null) { this.myProperties.myPerception = this.GetComponent<Perception>(); this.myProperties.myPerception.myOwner = this; } if (this.myProperties.myAttack == null) { this.myProperties.myAttack = transform.Find("Attacks").GetComponent<PlayerAttack>(); } //this.myProperties.myTargetting = this.GetComponent<Targetting>(); //this.myProperties.myTargetting.myOwner = this; if (input == null || movement == null || playerAnimation == null || playerSounds == null|| anim == null || animEvents == null || col == null) { Debug.LogError("Key Component Missing on " + this); this.enabled = false; return; } if (myProperties.myAttack == null || myProperties.myPerception == null || circleGesture == null || punchCircle == null) { Debug.LogError("Attack Component Missing on " + this); this.enabled = false; return; } // CHARGE INPUT TYPE if (chargeType == ChargeType.Trigger && circleGesture != null) { circleGesture.enabled = false; } #endregion StartListening(); }
private void Awake() { ui = FindObjectOfType <CooldownUI>(); player = GetComponentInParent <PlayerController>(); }