Ejemplo n.º 1
0
    public void Init(ObjectColor color, Vector3 position, Sprite sprite)
    {
        //TODOchange after gobals
        _sprite.gameObject.SetActive(true);
        _objectColor = color;
        float randX = Random.Range(-0.25f, 0.25f);

        transform.position = new Vector3(position.x + randX, position.y, position.z);
        //add random rotation
        transform.rotation = Quaternion.Euler(transform.rotation.x, transform.rotation.y, Random.Range(0, 360));
        _sprite.sprite     = sprite;
        if (!_light)
        {
            Debug.Log("rbrak light");
        }
        else
        {
            switch (color)
            {
            case ObjectColor.BLUE:
                _light.color = Color.blue;
                break;

            case ObjectColor.RED:
                _light.color = Color.red;
                break;

            case ObjectColor.YELLOW:
                _light.color = Color.yellow;
                break;

            case ObjectColor.GREEN:
                _light.color = Color.green;
                break;
            }
        }

        _circleCollider2D.enabled = true;

        if (tapParticles)
        {
            ParticleSystem.MainModule main = tapParticles.main;
            main.loop        = false;
            main.playOnAwake = false;
            main.startColor  = Color.Lerp(_objectColor.GetColor(), Color.white, 0.6f);
            tapParticles.Stop();
        }
        if (holdParticles)
        {
            ParticleSystem.MainModule main = holdParticles.main;
            main.loop        = true;
            main.playOnAwake = false;
            Color col = _objectColor.GetColor();
            main.startColor = Color.Lerp(_objectColor.GetColor(), Color.white, 0.6f);
            holdParticles.Stop();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// レイガンのコアの描画設定を現在のレーザーの状態に合わせる
    /// </summary>
    private void ApplyRayGunCoreMaterial()
    {
        rayGunLight.color = ObjectColor.GetColor(lasers[currentLaserIndex].color);
        switch (lasers[currentLaserIndex].color)
        {
        case ColorState.RED:
            rayGunCoreCylinder.GetComponent <MeshRenderer>().material = rayGunCoreRedMaterial;
            break;

        case ColorState.GREEN:
            rayGunCoreCylinder.GetComponent <MeshRenderer>().material = rayGunCoreGreenMaterial;
            break;

        case ColorState.BLUE:
            rayGunCoreCylinder.GetComponent <MeshRenderer>().material = rayGunCoreBlueMaterial;
            break;
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks if the two ObjectColor objects have the same color.
 /// </summary>
 public bool CheckSameColor(ObjectColor other) {
     return CheckSameColor(other.GetColor());
 }