Example #1
0
 // Update is called once per frame
 void Update()
 {
     CanBePainted.PaintPoint(
         new Vector3(transform.position.x, 0, transform.position.z),
         config.GETTEAMCOLR(GetComponent <Painter>().team),
         GetComponent <Painter>().threshold);
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (RemainTime > 0)
        {
            RemainTime -= Time.deltaTime;

            float team1  = CanBePainted.GETCOLOR(config.GETTEAMCOLR(0));
            float team2  = CanBePainted.GETCOLOR(config.GETTEAMCOLR(1));
            float dist   = (Mathf.Abs(team1 - team2)) / (team1 + team2);
            int   winner = team1 > team2 ? 0 : 1;

            currentWin = config.GETTEAMCOLR(winner);


            transform.GetChild(winner).GetComponent <move2dst>().setdst(
                new Vector3(transform.GetChild(winner).position.x,
                            0.5f,
                            Mathf.Lerp(transform.GetChild(winner).position.z, -9.81f + (RemainTime / TotalTime) * Totalmove, Time.deltaTime)));

            transform.GetChild(winner == 0 ? 1 : 0).GetComponent <move2dst>().setdst(
                new Vector3(transform.GetChild(winner).position.x,
                            0.2f,
                            transform.GetChild(winner).position.z + dist * 10));


            updateTimebar(currentWin, Color.black);


            if (RemainTime <= 0)
            {
                resultScene.SetActive(true);
                resultScene.transform.GetChild(1).GetComponent <Image>().color = config.GETTEAMCOLR(winner);
            }
        }
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        transform.position   = new Vector3(transform.position.x, transform.GetComponent <SphereCollider>().radius *transform.localScale.y, transform.position.z);
        transform.localScale = new Vector3(transform.localScale.x * smallerFactor, transform.localScale.y * smallerFactor, transform.localScale.z * smallerFactor);

        if ((transform.localScale.x < dispearThreshold) || (transform.localScale.y < dispearThreshold) || (transform.localScale.z < dispearThreshold))
        {
            Destroy(gameObject);
        }

        CanBePainted.PaintPoint(
            new Vector3(transform.position.x, 0, transform.position.z),
            config.GETTEAMCOLR(GetComponent <Painter>().team),
            GetComponent <SphereCollider>().radius *transform.localScale.y);
    }
Example #4
0
    private void emitChangeColor(float r)
    {
        if (Time.timeScale < 1)
        {
            return;
        }
        detectObjR = r;

        CanBePainted.PaintPoint(transform.position, config.GETTEAMCOLR(ownerteam), r);

        if (r == 1)
        {
            GameObject ripple = Instantiate(splashEffect);
            ripple.transform.position = transform.position + Vector3.up * 0.01f;
            var ps = ripple.GetComponent <ParticleSystem>().main;
            ps.startSize = radius * 1.5f;
        }
    }
Example #5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.GetComponent <Painter>() != null)
        {
            int team;
            if (other.gameObject.GetComponent <Player>() != null)
            {
                team = other.gameObject.GetComponent <Player>().getTeam();
            }
            else
            {
                team = other.gameObject.GetComponent <Painter>().team;
            }

            if (team != -1)
            {
                GameObject paint = Instantiate(PaintEffect, transform.position, transform.rotation);
                ParticleSystem.MainModule newMain = paint.transform.GetChild(0).GetComponent <ParticleSystem>().main;
                newMain.startColor = config.GETTEAMCOLR(team);

                CanBePainted.PaintPoint(transform.position, config.GETTEAMCOLR(team), explosionR);
            }
        }
    }
Example #6
0
    void Update()
    {
        if (isDead)
        {
            return;
        }

        //被其他顏色打到後被染色一陣子
        if (Painted > 0)
        {
            if (transform.position.y <= 0.6)
            {
                Painted -= 0.2f;
            }

            GameObject obj = Instantiate(paintedeffct);
            obj.transform.position = transform.position;
            obj.transform.parent   = transform;

            ParticleSystem.MainModule newMain = obj.transform.GetChild(0).GetComponent <ParticleSystem>().main;
            newMain.startColor = config.GETTEAMCOLR(painterTeam);

            CanBePainted.PaintPoint(new Vector3(transform.position.x, 0, transform.position.z), config.GETTEAMCOLR(painterTeam), 2.5f);
        }
        else if (Painted <= 0)
        {
            //沒被染色
            GetComponent <Painter>().threshold = 0;
            painterTeam = -1;

            //案件偵測(沒被染色才能移動)
            if (networking == false)
            {
                if ((MydropBombCoolDown <= 0) && (Input.GetKey(inputKey[(int)inputkeys.ATTACK])))
                {
                    latestPressbtn = (int)inputkeys.ATTACK;
                }
                else if (Input.GetKey(inputKey[(int)inputkeys.UP]))
                {
                    latestPressbtn = (int)inputkeys.UP;
                }
                else if (Input.GetKey(inputKey[(int)inputkeys.DOWN]))
                {
                    latestPressbtn = (int)inputkeys.DOWN;
                }
                else if (Input.GetKey(inputKey[(int)inputkeys.LEFT]))
                {
                    latestPressbtn = (int)inputkeys.LEFT;
                }
                else if (Input.GetKey(inputKey[(int)inputkeys.RIGHT]))
                {
                    latestPressbtn = (int)inputkeys.RIGHT;
                }
                else
                {
                    latestPressbtn = -1;
                }
            }


            if (FPSview == false)
            {
                keydownResponse(latestPressbtn);
            }
            else
            {
                KeydownFPS();
            }
        }

        //放水球的冷卻時間
        if (MydropBombCoolDown > 0)
        {
            MydropBombCoolDown -= Time.deltaTime;
        }
    }