예제 #1
0
        public void BuyUpgradeTile()
        {
            if (TileManagerScript.Instance.CheckInteractableTile(new Vector3(transform.position.x - 1, transform.position.y - 0.46f, transform.position.z)) == true)
            {
                TileScript tempTile = TileManagerScript.Instance.getTile(new Vector3(transform.position.x - 1, transform.position.y - 0.46f, (int)transform.position.z)).gameObject.GetComponent <TileScript>();

                if (tempTile.owner == TileScript.Owner.None)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Sadako;
                    }
                    else if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Kayako;
                    }
                    else if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Jami;
                    }
                    else if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.DemonFox;
                    }
                }

                if (tempTile.owner == TileScript.Owner.Sadako)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.SadokoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Kayako)
                {
                    if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.KayakoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Jami)
                {
                    if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.JamiBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.DemonFox)
                {
                    if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.DemonFoxBuilding(-90.0f);
                    }
                }
            }
            else if (TileManagerScript.Instance.CheckInteractableTile(new Vector3(transform.position.x + 1, transform.position.y - 0.46f, transform.position.z)) == true)
            {
                TileScript tempTile = TileManagerScript.Instance.getTile(new Vector3(transform.position.x + 1, transform.position.y - 0.46f, (int)transform.position.z)).gameObject.GetComponent <TileScript>();

                if (tempTile.owner == TileScript.Owner.None)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Sadako;
                    }
                    else if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Kayako;
                    }
                    else if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Jami;
                    }
                    else if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.DemonFox;
                    }
                }

                if (tempTile.owner == TileScript.Owner.Sadako)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.SadokoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Kayako)
                {
                    if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.KayakoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Jami)
                {
                    if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.JamiBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.DemonFox)
                {
                    if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.DemonFoxBuilding(-90.0f);
                    }
                }
            }
            else if (TileManagerScript.Instance.CheckInteractableTile(new Vector3(transform.position.x, transform.position.y - 0.46f, transform.position.z - 1)) == true)
            {
                TileScript tempTile = TileManagerScript.Instance.getTile(new Vector3(transform.position.x, transform.position.y - 0.46f, (int)transform.position.z - 1)).gameObject.GetComponent <TileScript>();

                if (tempTile.owner == TileScript.Owner.None)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Sadako;
                    }
                    else if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Kayako;
                    }
                    else if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Jami;
                    }
                    else if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.DemonFox;
                    }
                }

                if (tempTile.owner == TileScript.Owner.Sadako)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.SadokoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Kayako)
                {
                    if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.KayakoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Jami)
                {
                    if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.JamiBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.DemonFox)
                {
                    if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.DemonFoxBuilding(-90.0f);
                    }
                }
            }
            else if (TileManagerScript.Instance.CheckInteractableTile(new Vector3(transform.position.x, transform.position.y - 0.46f, transform.position.z + 1)) == true)
            {
                TileScript tempTile = TileManagerScript.Instance.getTile(new Vector3(transform.position.x, transform.position.y - 0.46f, (int)transform.position.z + 1)).gameObject.GetComponent <TileScript>();

                if (tempTile.owner == TileScript.Owner.None)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Sadako;
                    }
                    else if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Kayako;
                    }
                    else if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.Jami;
                    }
                    else if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.owner = TileScript.Owner.DemonFox;
                    }
                }

                if (tempTile.owner == TileScript.Owner.Sadako)
                {
                    if (gameObject.name == "Sadako Model(Clone)")
                    {
                        tempTile.SadokoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Kayako)
                {
                    if (gameObject.name == "Kayako Model(Clone)")
                    {
                        tempTile.KayakoBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.Jami)
                {
                    if (gameObject.name == "Jami Model(Clone)")
                    {
                        tempTile.JamiBuilding(-90.0f);
                    }
                }
                else if (tempTile.owner == TileScript.Owner.DemonFox)
                {
                    if (gameObject.name == "Demon Fox Model(Clone)")
                    {
                        tempTile.DemonFoxBuilding(-90.0f);
                    }
                }
            }

            GUIManagerScript.Instance.buyTileCanvas.SetActive(false);
            GameManager.Instance.NextTurn();
        }