예제 #1
0
    // Use this for initialization
    void Start()
    {
        m_animator   = GetComponent <Animator>();
        m_startScale = transform.localScale;

        m_startPos = m_moveObject.position;

        m_broom    = GetComponentInChildren <PlayerBroom>();
        m_broomCol = m_broom.GetComponent <Collider>();

        asource = GetComponent <AudioSource>();

        Cursor.visible = false;

        var main = psKillcount.main;

        psKillcountStartColor = main.startColor.color;

        rends          = GetComponentsInChildren <Renderer>();
        rendStartColor = rends[0].material.GetColor("_Color");

        //Time.timeScale = 0.2f;
        if (m_ccedParticle)
        {
            JEffectPool.CreatePool(m_ccedParticle, 5);
        }

        StartCoroutine(InitGame());
        StartCoroutine(KillCountChecker());
    }
예제 #2
0
    public void CC()
    {
        if (m_broom.enabled == true)
        {
            return;
        }

        if (isCCed == true)
        {
            return;
        }

        if (m_ccedParticle)
        {
            var hitobj = JEffectPool.CreateEffect(m_ccedParticle);
            hitobj.transform.position = transform.position + new Vector3(0, 5, 0);
            hitobj.transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z);

            hitobj.GetComponent <AudioSource>().Play();
            //hitobj.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, hitobj.transform.rotation.eulerAngles.y, hitobj.transform.rotation.eulerAngles.z); //endast för 2D
        }

        for (int i = 0; i < rends.Length; i++)
        {
            rends[i].material.color = ccedColor;
        }

        m_animator.SetFloat("ExtraSpeed", 0.6f);
        StartCoroutine(GetCCed());
    }
예제 #3
0
 private new void OnDestroy()
 {
     if (m_instance == this)
     {
         base.OnDestroy();
         m_particleEmitters.Clear();
         m_instance = null;
     }
 }
예제 #4
0
    public void M_Die()
    {
        if (m_deathParticle)
        {
            var hitobj = JEffectPool.CreateEffect(m_deathParticle);
            hitobj.transform.position = transform.position;
            hitobj.transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z);
            //hitobj.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, hitobj.transform.rotation.eulerAngles.y, hitobj.transform.rotation.eulerAngles.z); //endast för 2D
        }

        Destroy(gameObject);
    }
예제 #5
0
    private void Awake()
    {
        if (m_instance == null)
        {
            m_instance = this;
        }
#if UNITY_EDITOR
        else
        {
            print("Multiple instances of " + name + " created, destroying object.");
        }
#endif
    }
예제 #6
0
    // Use this for initialization
    void Awake()
    {
        if (killCountText == null)
        {
            killCountText = GameObject.FindGameObjectWithTag("KillCount").GetComponent <Text>();
        }

        m_currHealth = m_maxHealth;

        if (m_deathParticle)
        {
            JEffectPool.CreatePool(m_deathParticle, 10);
        }

        m_immortal = false;

        m_killedbyPlayer = false;
    }
예제 #7
0
    public void M_Die(Vector3 vec)
    {
        if (m_deathParticle)
        {
            var hitobj             = JEffectPool.CreateEffect(m_deathParticle);
            ExplosionChildren expl = hitobj.GetComponent <ExplosionChildren>();
            if (expl)
            {
                expl.Explode(vec);
            }
            hitobj.transform.position = transform.position;
            hitobj.transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z);
            //hitobj.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, hitobj.transform.rotation.eulerAngles.y, hitobj.transform.rotation.eulerAngles.z); //endast för 2D
        }

        if (m_killedbyPlayer)
        {
            killCount++;
            killCountText.text = killCount.ToString();
        }

        Destroy(gameObject);
    }