protected override void Awake() { base.Awake(); GameObject lowFoodGO = Instantiate(Content2D.Instance.Prefab_HungerWarning); lowFoodWarning = lowFoodGO.GetComponent <BlinkSprite>(); Transform lowFoodTr = lowFoodGO.transform; lowFoodTr.SetParent(MyTr, false); lowFoodTr.localPosition = Vector3.zero; lowFoodTr.localScale = Vector3.one; lowFoodTr.localRotation = Quaternion.identity; }
// Use this for initialization void Start() { collider = GetComponent <Collider2D>(); blinking = GetComponent <BlinkSprite>(); camBounds = Camera.main.GetComponent <CameraUtils>(); respawn = Camera.main.transform.FindChild("RespawnPoint"); BulletExitPoint = transform.FindChild("BulletExitPoint"); healthUI = GameObject.Find("HealthBar").GetComponent <HealthManager>(); currhealth = character.MaxHealth; for (int i = 0; i < currhealth; i++) { healthUI.AddHeart(); } beams = new List <GameObject>(); currCharging = 0; }
void Awake() { _rigidbody = GetComponent <Rigidbody2D>(); _transform = transform; _bodyContacts = new ContactPoint2D[2]; _bodyContactsFilter.SetLayerMask(LayerMask.GetMask(TagAndLayer.Layer.Ground) | LayerMask.GetMask(TagAndLayer.Layer.Platform)); _previousFriction = _dynamicPhysics.friction; _animator = GetComponent <Animator>(); _animGroundedBool = Animator.StringToHash(AnimatorKey.Grounded); _animVerticalSpeedFloat = Animator.StringToHash(AnimatorKey.VerticalSpeed); _blinkSprite = GetComponent <BlinkSprite>(); _isInvincible = false; _invincibleTime = 3.0f; _isTalking = false; _groundLayerMask = LayerMask.GetMask(TagAndLayer.Layer.Ground) | LayerMask.GetMask(TagAndLayer.Layer.Platform); InitState(); }
public virtual void Start() { _shakeSprite = new ShakeSprite(spriteRenderer); _blinkSprite = new BlinkSprite(spriteRenderer); audioSourceCH02 = gameObject.AddComponent <AudioSource>(); }