void Distraction() { Chick settingTgt = bbychick.GetComponent <Chick>(); float distractDis = Vector2.Distance(chick.transform.position, transform.position); if (distractDis < 2) { settingTgt.SetTarget(transform); close = true; } }
public void PreInitialize() { smokeCANCER = Resources.Load <VisualEffect>("Prefabs/Smoke"); float intensity = 2; factor = Mathf.Pow(2, intensity); lookAt1 = GameObject.FindWithTag("LookAt1").transform; lookAt2 = GameObject.FindWithTag("LookAt2").transform; chick = Resources.Load <Chick>("Player/Chick/Chick"); bulletPrefab = Resources.Load <GameObject>("Prefabs/Bullet/Egg"); this.stepsParticuleSystem = Resources.Load <GameObject>("VFX/Steps"); chickAnimator = chick.GetComponent <Animator>(); eggCompleted = true; this.numberEgg = 2; this.nextCannonPosition = 0; this.nextCannonPrefab = 0; this.cannonPrefabs = new List <GameObject>(); rb = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); onDash = new CustomEvent(); onDie = new CustomEvent(); onThrow = new CustomEvent(); onStartMoving = new CustomEvent(); onStopMoving = new CustomEvent(); currentInput = new Vector2(); SubscribeCustomEvent(Event.DIE, onDie); SubscribeCustomEvent(Event.DASH, onDash); SubscribeCustomEvent(Event.TRHOW, onThrow); SubscribeCustomEvent(Event.START_MOVING, onStartMoving); SubscribeCustomEvent(Event.STOP_MOVING, onStopMoving); AddAction(Event.DIE, Die); AddAction(Event.DASH, Dash); AddAction(Event.TRHOW, Throw); AddAction(Event.START_MOVING, StartMoving); AddAction(Event.STOP_MOVING, StopMoving); AddAction(Event.FOOT_STEP_LEFT, Foot_Step_Left); AddAction(Event.FOOT_STEP_RIGHT, Foot_Step_Right); PlayerGlow(); }
void HideChick() { Chick settingTgt = chick.GetComponent <Chick>(); if (Input.GetButtonDown(hideButton) || Input.GetAxisRaw(hideButton) > 0) { GameManager.instance.hideTheChick = true; settingTgt.SetTarget(transform); mySpriteRenderer.sortingOrder = 2; } else if (Input.GetButtonUp(hideButton) || Input.GetAxisRaw(hideButton) <= 0) { GameManager.instance.hideTheChick = false; mySpriteRenderer.sortingOrder = 0; } }
void HideChick() { if (!GameManager.instance.restartingFromLastCheckpoint) { Chick settingTgt = chick.GetComponent <Chick>(); if (Input.GetButtonDown(hideButton) || Input.GetAxisRaw(hideButton) > 0) { GameManager.instance.hideTheChick = true; settingTgt.SetTarget(transform); } else if (Input.GetButtonUp(hideButton) || Input.GetAxisRaw(hideButton) <= 0) { GameManager.instance.hideTheChick = false; } } }
public void SmackThatChick() { currentNumOfChick++; Chick chicky = Instantiate(chick, new Vector3(254, 133, 439), Quaternion.identity); chicky.Initialize(); if (AssID == 10) { chicky.firstPlayer = true; //chicky.transform.LookAt(lookAt1); } else { chicky.firstPlayer = false; //chicky.transform.LookAt(lookAt2); } if (nextCannonPosition == this.cannonPosition.Count) { nextCannonPosition = 0; } if (AssID == 10) { //chicky.transform.LookAt(lookAt1); chicky.SetCannonPosition(this.cannonPosition[nextCannonPosition++] + new Vector3(-19f, 13f, ((7 * multipleP1) - 3))); multipleP1 += 1; } else { chicky.SetCannonPosition(this.cannonPosition[nextCannonPosition++] - new Vector3((11 * multipleP2) + 36f, 0, (-3 * multipleP2) + 24f)); multipleP2 += 1; } PlayerManager.Instance.chicksssss.Add(chicky); if (currentNumOfChick < 5) { SwapCannonPrefab(); } }
private void Start() { health.value = mood.value = 100; rigidbody = GetComponent <Rigidbody>(); // get the transform of the main camera if (Camera.main != null) { m_Cam = Camera.main.transform; } else { Debug.LogWarning( "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject); // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them! } // get the third person character ( this should never be null due to require component ) m_Character = GetComponent <Chick>(); differ = Camera.main.transform.position - transform.position; }
void Awake() { _chick = GetComponentInParent <Chick>(); }
void Awake() { _chick = GetComponentInParent<Chick>(); }