Exemple #1
0
    private void Start()
    {
        parentObj = transform.parent.gameObject;

        AIcol      = GetComponent <SphereCollider>();
        pControl   = parentObj.GetComponent <Player_Movement_Controller>();
        fBS        = parentObj.GetComponent <Fighter_Battle_Script>();
        fSS        = parentObj.GetComponent <Fighter_Stats_Script>();
        anim       = parentObj.GetComponent <Animator>();
        controller = parentObj.GetComponent <CharacterController>();

        teamInt = fSS.teamInt;

        if (fSS.AILevel == 0)
        {
            gameObject.SetActive(false);
        }
    }
Exemple #2
0
    public void DeathTest()
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }


        int  tempInt  = 0;
        bool tempBool = false;

        for (int i = 0; i < GLplayerList.Count; i++)
        {
            GameObject player = GLplayerList[i];

            Fighter_Stats_Script fSS = player.GetComponent <Fighter_Stats_Script>();

            if (tempInt != 0)
            {
                if (tempInt != fSS.teamInt)
                {
                    if (fSS.currentHealth > 0)
                    {
                        tempInt  = fSS.teamInt;
                        tempBool = true;
                    }
                }
            }
            else
            {
                if (fSS.currentHealth > 0)
                {
                    tempInt = fSS.teamInt;
                }
            }
        }

        victoryTeam = tempInt;

        if (!tempBool)
        {
            photonView.RPC("Finish", PhotonTargets.All);
        }
    }
Exemple #3
0
    public void FoundColl(GameObject colObj, GameObject sourceCol)
    {
        if (!photonView.isMine)
        {
            return;
        }

        GameObject somebody = colObj.gameObject;

        if (somebody.layer == LayerMask.NameToLayer("Character"))
        {
            if (somebody != source && somebody.GetComponent <Fighter_Stats_Script>() != null && teamInt != somebody.GetComponent <Fighter_Stats_Script>().teamInt)
            {
                if (somebody.GetComponent <Fighter_Stats_Script>() != null && teamInt != somebody.GetComponent <Fighter_Stats_Script>().teamInt)
                {
                    if (hitList.Contains(somebody) == false)
                    {
                        hitList.Add(somebody);

                        Fighter_Stats_Script fSS = somebody.GetComponent <Fighter_Stats_Script>();

                        Vector3 fromPosition = source.transform.position;
                        Vector3 toPosition   = somebody.transform.position;
                        Vector3 direction    = toPosition - fromPosition;


                        Ray landingRay = new Ray(fromPosition, direction);

                        if (DeathEffect != null)
                        {
                            GameObject ParticlePrefab = PhotonNetwork.Instantiate(DeathEffect.transform.name, sourceCol.transform.position, Quaternion.Euler(0, 0, 0), 0);

                            ParticlePrefab.GetComponent <SubEmitterScript>().photonView.RPC("KillObject", PhotonTargets.All, particleTimer);
                        }

                        fSS.DamageTarget(damage, direction, ImpactUp, ImpactBack, source, responderObj, null);
                    }
                }
            }
        }
    }
Exemple #4
0
    private void Start()
    {
        fSS        = GetComponent <Fighter_Stats_Script>();
        anim       = GetComponent <Animator>();
        rb         = GetComponent <Rigidbody>();
        cc         = GetComponent <CapsuleCollider>();
        controller = GetComponent <CharacterController>();

        if (transform.rotation.y == 0)
        {
            facing = 1;
        }
        else
        {
            facing = -1;
        }

        cHeight = controller.height;
        cVector = controller.center;
        cRadius = controller.radius;
    }
Exemple #5
0
    IEnumerator waitFunc1(float wait)
    {
        yield return(new WaitForSeconds(wait));

        finishObj.SetActive(false);

        scoreBoard.SetActive(true);

        if (PhotonNetwork.offlineMode == false)
        {
            scoreBoard.transform.Find("Button_Restart").GetComponent <Button>().interactable = false;
            scoreBoard.transform.Find("Button_Exit").GetComponent <Button>().interactable    = false;
        }

        if (PhotonNetwork.isMasterClient)
        {
            for (int i = 0; i < GLplayerList.Count; i++)
            {
                Fighter_Stats_Script fSS = GLplayerList[i].GetComponent <Fighter_Stats_Script>();

                fSS.photonView.RPC("UpdateScore", PhotonTargets.All);
            }
        }
    }