Esempio n. 1
0
 private void ChangeKartPreview()
 {
     if (GetLocalPlayerInfo() != null)
     {
         if (kartPreview == null)
         {
             foreach (Kart kart in FindObjectOfType <CharacterList>().karts)
             {
                 if (kart.kartEnumValue == GetLocalPlayerInfo().currentSelectedKart)
                 {
                     kartPreview           = Instantiate(kart.variations[GetLocalPlayerInfo().kartVariation], kartPreviewTransform.position, kartPreviewTransform.rotation) as GameObject;
                     selectedKartText.text = kart.kartName;
                     ChangeDriver();
                     RemoveComponentsFromPreview();
                     ObjectRotator rotator = kartPreview.AddComponent <ObjectRotator>();
                     rotator.Y = true;
                     rotator.anglePerSecond = -3;
                     if (FindObjectOfType <GameModeHandler>().teams == GameModeTeams.Two)
                     {
                         GetLocalPlayerInfo().kartVariation = (int)(GetLocalPlayerInfo().GetComponent <CharacterTeam>().team);
                     }
                     break;
                 }
             }
         }
     }
 }
Esempio n. 2
0
    IEnumerator GenerateTargetBlock()
    {
        if (size % 2 == 0)
        {
            startGeneratePosition = targetBlockMother.transform.position - new Vector3((lengthX - 1) / 2f, (lengthY - 1) / 2f, (lengthZ - 1) / 2f);
        }
        else
        {
            startGeneratePosition = targetBlockMother.transform.position - new Vector3(lengthX / 2f, lengthY / 2f, lengthZ / 2f);
        }

        for (int x = 0; x < lengthX; x++)
        {
            for (int y = 0; y < lengthY; y++)
            {
                for (int z = 0; z < lengthZ; z++)
                {
                    var newtargetBlock = Instantiate(targetBlock, startGeneratePosition + new Vector3(x, y, z), Quaternion.identity);
                    newtargetBlock.transform.parent = targetBlockMother.transform;
                }
                yield return(null);
            }
        }


        ObjectRotator targetObjectRotator = targetBlockMother.GetComponent <ObjectRotator>();

        targetObjectRotator.enabled       = true;
        targetObjectRotator.RotationAxisX = true;
    }
    // Start is called before the first frame update
    void Start()
    {
        myRigidbody2D     = GetComponent <Rigidbody2D>();
        myConstantForce2D = GetComponent <ConstantForce2D>();
        myObjectRotator   = GetComponent <ObjectRotator>();
        if (!myObjectRotator)
        {
            Debug.Log(gameObject.name + " has no object rotator. Disabling its lashhandler");
            this.enabled = false;
            //We cant run without a rotator, so disable selt
        }

        stormlightCloud = GetComponentInChildren <ParticleSystem>();
        stormlightCloud.Pause();
    }
 // Start is called before the first frame update
 void Start()
 {
     myObjectRotator     = GetComponent <ObjectRotator>();
     myRigidBody         = GetComponent <Rigidbody2D>(); myAnimator = GetComponent <Animator>();
     myConstantForce2D   = GetComponent <ConstantForce2D>();
     myCapsuleCollider2D = GetComponent <CapsuleCollider2D>();
     myBoxCollider2D     = GetComponentInChildren <BoxCollider2D>();
     myAnimator          = GetComponent <Animator>();
     myAudioSource       = GetComponent <AudioSource>();
     //_health = _maxHealth;
     stormlightCloud = GetComponentInChildren <ParticleSystem>();
     if (_stormlight > 0)
     {
         stormlightCloud.Play();
     }
 }
    IEnumerator GenerateMissionBlock(List <Dictionary <string, string> > missionCheckerPosition)
    {
        if (size % 2 == 0)
        {
            startGeneratePosition = missionBlockMother.transform.position - new Vector3((lengthX - 1) / 2f, (lengthY - 1) / 2f, (lengthZ - 1) / 2f);
        }
        else
        {
            startGeneratePosition = missionBlockMother.transform.position - new Vector3(lengthX / 2f, lengthY / 2f, lengthZ / 2f);
        }

        //Initailize array

        for (int x = 0; x < lengthX; x++)
        {
            for (int y = 0; y < lengthY; y++)
            {
                for (int z = 0; z < lengthZ; z++)
                {
                    IsExist[x, y, z] = true;
                }
            }
        }

        for (int x = 0; x < lengthX; x++)
        {
            for (int y = 0; y < lengthY; y++)
            {
                for (int z = 0; z < lengthZ; z++)
                {
                    for (int i = 0; i < missionCheckerPosition.Count; i++)
                    {
                        if (missionCheckerPosition[i]["X"] == "RaycastReceiverX" + x.ToString() && missionCheckerPosition[i]["Y"] == "RaycastReceiverY" + y.ToString() && missionCheckerPosition[i]["Z"] == "RaycastReceiverZ" + z.ToString())
                        {
                            IsExist[x, y, z] = false;
                        }
                    }
                }
            }
        }

        //Mission Block 생성
        for (int x = 0; x < lengthX; x++)
        {
            for (int y = 0; y < lengthY; y++)
            {
                for (int z = 0; z < lengthZ; z++)
                {
                    if (IsExist[x, y, z] == true)
                    {
                        var newMissionBlock = Instantiate(missionBlock, startGeneratePosition + new Vector3(x, y, z), Quaternion.identity);
                        newMissionBlock.transform.parent = missionBlockMother.transform;
                    }
                }
                yield return(null);
            }
        }


        ObjectRotator MissionObjectRotator = missionBlockMother.GetComponent <ObjectRotator>();

        MissionObjectRotator.enabled       = true;
        MissionObjectRotator.RotationAxisX = true;
    }