Inheritance: MonoBehaviour
Beispiel #1
0
        public void UpdateStatus()
        {
            var  enemyStats  = this.enemyTracked.EnemyStats;
            bool enemyIsDead = enemyStats.CurrentHealth <= 0;

            if (enemyIsDead)
            {
                EnemyHealthbarLoader.Instance.ReturnHealthbar(this.enemyTracked);
                this.Cease();
                return;
            }

            float fill = Mathf.Clamp01(enemyStats.CurrentHealth / enemyStats.MaxHealth);

            this.fillImage.fillAmount = fill;

            Vector2 anchoredPos = TrackingCamera.GetAnchorPos(this.enemyTracked.transform.localPosition, this.Canvas.transform as RectTransform);
            var     displayPos  = anchoredPos + this.offset;

            this.fillImage.rectTransform.anchoredPosition  = displayPos;
            this.background.rectTransform.anchoredPosition = displayPos;

            if (!this.Canvas.enabled)
            {
                this.Canvas.enabled = true;
            }
        }
Beispiel #2
0
        public void LoadDamageUI(float damage, Vector3 at, bool isCritical = false)
        {
            DamageUI ui = this.GetInacitveUI();

            var     anchoredPosition = TrackingCamera.GetAnchorPos(at, transform as RectTransform);
            Vector2 displayPos       = anchoredPosition + Vector2.left * this.offset;

            ui.DisplayDamage(spawnPos: displayPos, damage: damage, isCritical: isCritical);
        }
Beispiel #3
0
    public void RegisterToTrackingCamera()
    {
        GameObject camera = GameObject.Find("Main Camera");

        if (camera)
        {
            TrackingCamera tracking = camera.GetComponentInChildren <TrackingCamera>();

            if (tracking)
            {
                tracking.player = this;
            }
        }
    }
 public void Hit(int damage)
 {
     if (isDead)
     {
         return;
     }
     DisableMovement = true;
     StartCoroutine(Reactivate());
     ppAnimator.PlayerAttacked();
     SoundSystem.Play("enemy collision", 1, enemyColVol);
     TrackingCamera.ShakeIt(0.5f, 0.5f);
     health -= damage;
     if (!SoundSystem.IsPlaying("breathing") && health > 0)
     {
         SoundSystem.Play("breathing", 1, 0.25f);
         playedBreathingStops = false;
     }
     hitTime = Time.time;
     spriteRenderer.sprite = woundedSprite;
     if (health <= 0)
     {
         Die();
     }
 }
Beispiel #5
0
 public void Init()
 {
     m_player = AssetManager.Instance.Character.Retrieve("Player", LocalData.Instance.Nickname, LocalData.Instance.Level) as Player;
     m_player.transform.position = m_playerInitPos;
     TrackingCamera.SetTarget(m_player.transform);
 }
Beispiel #6
0
    private void Awake()
    {
        SetUp();

        TrackingCamera.SetTarget(player.transform);
    }