예제 #1
0
    void Update()
    {
        //Place a face. <AL>
        if (Input.GetKeyDown(KeyCode.Return))
        {
            pos   = cam.GetState();
            floor = cam.GetFloor();

            ToBePlaced = TowerFaces[Random.Range(1, 4)];
            ToBePlaced.gameObject.transform.localScale = new Vector3(2.5f, 2.65f, 1f);

            //Face placing per side per floor. <AL>
            if (pos == 2)
            {
                if (FacesPlaced[pos, floor] == 0)
                {
                    Instantiate(ToBePlaced, new Vector3(11f, (-4.3f + 4.1f * floor * 2f), -10f), Quaternion.Euler(0, 90, 0));
                    FacesPlaced[pos, floor]++;
                }
            }
            else if (pos == 4)
            {
                if (FacesPlaced[pos, floor] == 0)
                {
                    Instantiate(ToBePlaced, new Vector3(10f, (-4.3f + 4.1f * floor * 2f), 11f), Quaternion.Euler(0, 0, 0));
                    FacesPlaced[pos, floor]++;
                }
            }
            else if (pos == 6)
            {
                if (FacesPlaced[pos, floor] == 0)
                {
                    Instantiate(ToBePlaced, new Vector3(-11f, (-4.3f + 4.1f * floor * 2f), 10f), Quaternion.Euler(0, 270, 0));
                    FacesPlaced[pos, floor]++;
                }
            }
            else if (pos == 8)
            {
                if (FacesPlaced[pos, floor] == 0 && floor != 0)
                {
                    Instantiate(ToBePlaced, new Vector3(-10f, (-4.3f + 4.1f * floor * 2f), -11f), Quaternion.Euler(0, 180, 0));
                    FacesPlaced[pos, floor]++;
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            //For debugging. Shows me position, floor, and array data in console. Remove when unneeded. <AL>
            pos   = cam.GetState();
            floor = cam.GetFloor();
            print("Pos: " + pos + "," + "Floor: " + floor + ", Array: " + FacesPlaced[pos, floor]);
        }
    }
예제 #2
0
파일: Destroy.cs 프로젝트: Glenn415/MEGATAP
 private void Start()
 {
     bottomPlayer = GameObject.Find("Player 1").GetComponent <CameraOneRotator>();
     topPlayer    = GameObject.Find("Player 2 Camera").GetComponent <CameraTwoRotator>();
     floor        = topPlayer.GetFloor();
     face         = topPlayer.GetState();
 }
예제 #3
0
    //private bool ghost = true;
    // Use this for initialization
    void Start()
    {
        prefab   = Resources.Load("projectile") as GameObject;
        trapBase = GetComponent <TrapBase>();
        cam      = GameObject.Find("Player 2 Camera").GetComponent <CameraTwoRotator>();
        animator = GetComponentInChildren <Animator>();

        if (!GetComponentInChildren <CheckMultipleBases>().Placed)
        {
            switch (cam.GetState())
            {
            case 1:
                transform.eulerAngles = new Vector3(0, 0, 0);
                projectileRotation    = Quaternion.identity;
                velocity = new Vector3(-20, 0, 0);
                break;

            case 2:
                transform.eulerAngles = new Vector3(0, 270, 0);
                projectileRotation    = Quaternion.Euler(0, -90, 0);
                velocity = new Vector3(0, 0, -20);
                break;

            case 3:
                transform.eulerAngles = new Vector3(0, 180, 0);
                projectileRotation    = Quaternion.Euler(0, -180, 0);
                velocity = new Vector3(20, 0, 0);
                break;

            case 4:
                transform.eulerAngles = new Vector3(0, 90, 0);
                projectileRotation    = Quaternion.Euler(0, -270, 0);
                velocity = new Vector3(0, 0, 20);
                break;
            }
        }
        else
        {
            switch (FaceNumberIfPrePlaced)
            {
            case 1:
                transform.eulerAngles = new Vector3(0, 0, 0);
                projectileRotation    = Quaternion.identity;
                velocity = new Vector3(-20, 0, 0);
                break;

            case 2:
                transform.eulerAngles = new Vector3(0, 270, 0);
                projectileRotation    = Quaternion.Euler(0, -90, 0);
                velocity = new Vector3(0, 0, -20);
                break;

            case 3:
                transform.eulerAngles = new Vector3(0, 180, 0);
                projectileRotation    = Quaternion.Euler(0, -180, 0);
                velocity = new Vector3(20, 0, 0);
                break;

            case 4:
                transform.eulerAngles = new Vector3(0, 90, 0);
                projectileRotation    = Quaternion.Euler(0, -270, 0);
                velocity = new Vector3(0, 0, 20);
                break;
            }
        }
    }