Пример #1
0
 public SnakeTail(GameObject gameObj, BoardPoint target, BoardPoint position)
 {
     this.gameObject = gameObj;
     this.movements  = new ObjMovements(this.gameObject, position);
     this.target     = target;
     this.position   = position;
 }
Пример #2
0
    public Grower(GameObject obj)
    {
        BoardPointFactory pointFac = new BoardPointFactory();

        this.position = pointFac.FromGameObjPosition(obj);
        this.movs     = new ObjMovements(obj.transform, this.position);
    }
Пример #3
0
 public SnakeTail(GameObject gameObj, BoardPoint position, DirectionEnum.Direction direction)
 {
     this.gameObject = gameObj;
     this.movements  = new ObjMovements(this.gameObject.transform, position);
     this.position   = position;
     this.direction  = direction;
 }
Пример #4
0
    public void Build(int iterator)
    {
        if (PoolManager.Instance.IfExist(iterator) == 0)    // если постройки даного типа закончились
        {
            btnTxtCounter[iterator].text = Buildings[iterator].objCount + "/" + Buildings[iterator].objCount;
            return;
        }

        Storage.SetActive(false);

        Vector3 newPos = Camera.main.transform.position + new Vector3(5f, 0f, 5f);     // позиция в которой появится постройка

        newPos.y = 0.5f;

        GameObject newBuilding = PoolManager.Instance.GetObject(iterator);

        newBuilding.transform.position = newPos;
        newBuilding.SetActive(true);
        newBuilding.GetComponentInChildren <ParticleSystem>().Play();
        ObjMovements newBuildingParams = newBuilding.GetComponent <ObjMovements>();

        newBuildingParams.arrayIndex = iterator;

        newBuildingParams.move     = true;
        newBuildingParams.objSizeX = Buildings[iterator].objSizeX;
        newBuildingParams.objSizeZ = Buildings[iterator].objSizeZ;

        // Запись оставшегося кол-ва доступных построек
        btnTxtCounter[iterator].text = (Buildings[iterator].objCount - PoolManager.Instance.IfExist(iterator)) + "/" + Buildings[iterator].objCount;
    }
Пример #5
0
    public SnakeTail Build(float x, float y, DirectionEnum.Direction direction)
    {
        GameObject   obj  = GameObject.Instantiate(prefab) as GameObject;
        BoardPoint   pos  = new BoardPoint(0, 0);
        ObjMovements movs = new ObjMovements(obj.transform, pos);

        movs.GoTo(x, y);
        return(new SnakeTail(obj, pos, direction));
    }
Пример #6
0
    public SnakeHead(GameObject gameObject)
    {
        BoardPointFactory pointFac = new BoardPointFactory();

        this.position   = pointFac.FromGameObjPosition(gameObject);
        this.gameObject = gameObject;
        this.direction  = Direction.UP;
        this.movements  = new ObjMovements(this.gameObject.transform, this.position);
        this.turns      = new List <Direction>();
    }