Exemple #1
0
    /*TODO:
     *
     * Slection currently hard coded for only player units, needs to work for enemy too
     *
     *
     *
     *
     *
     */


    //Class Constructor
    public virtual void Init(Generator mainmap, Overlord overlor, Vector2 loc)
    {
        //set cross variables
        mainMap  = mainmap;
        overlord = overlor;
        stdMath  = mainmap.stdMath;
        Random.InitState(stdMath.seed);

        //Initialize Character Controller
        anim = this.gameObject.GetComponent <Animator> ();
        //con = this.gameObject.AddComponent<CharacterController> ();
        //con.slopeLimit = 90;
        //con.center = new Vector3 (0, 1, 0);

        //set sight plane size
        tileLocation = loc;

        //set default layers
        defaultLayer        = overlord.defualtLayer;
        defaultLayerOutline = overlord.defualtLayerOutline;

        //set friendly/enemy status
        baseStats.overlord = overlor;
        baseStats.isEnemy  = !overlor.activePlayer;
    }
Exemple #2
0
    //Class constructor
    public override void Init(STDMath math, Overlord over, Generator gen)
    {
        //set base controls
        base.Init(math, over, gen);

        //initialize input classes
        // mouse = this.gameObject.AddComponent<MouseInput>();
        // keys = this.gameObject.AddComponent<KeyboardInput>();
        // mouse.con = keys.con = this;
    }
Exemple #3
0
 //Initialize Defense Script
 public void InitDefense(
     STDMath std, Generator gen, Antiplayer anti
     )
 {
     //initialzie external classes
     map        = gen;
     antiplayer = anti;
     stdMath    = std;
     Random.InitState(stdMath.seed);
 }
Exemple #4
0
    /* Upgrades left:
     *
     * Ranger: 2,3
     *
     *
     */

    //Initializer
    public override void Init(Unit u, Overlord o, STDMath m)
    {
        base.Init(u, o, m);

        //set unit upgrade actions
        for (int i = 0; i < numUnitUpgrades; ++i)
        {
            SetUnitUpgradeAction(i, GetUnitAction(i, true), GetUnitAction(i, false));
        }
    }
Exemple #5
0
    //Universal Initialization
    public virtual void Init(STDMath math, Overlord over, Generator gen)
    {
        //Reference cross class
        stdMath  = math;
        overlord = over;
        map      = gen;
        cam      = Camera.main;

        //initalize classes
        select = this.gameObject.AddComponent <Selector>();
        select.Init(this);
    }
Exemple #6
0
    //initialize Player
    public void InitPlayer(STDMath math, Generator gen, Assets asset)
    {
        //basic settings
        this.gameObject.name = "Player";


        //set starting tile
        //SetStart();

        //Add initial unit
        //CreateUnit(0,startingLocation);
    }
Exemple #7
0
    //Initialize
    public void Init(bool active, STDMath math, Overlord over, Generator mp)
    {
        //Set ecternal variables
        stdMath      = math;
        overlord     = over;
        map          = mp;
        activePlayer = active;

        //set empty action lists
        hireActions    = new UnityAction[5];
        controlActions = new UnityAction[5];
        specialActions = new UnityAction[5];
    }
Exemple #8
0
    //Base initializer
    public virtual void Init(Unit u, Overlord o, STDMath m)
    {
        //Set cross class
        stdMath  = m;
        overlord = o;
        unit     = u;

        //Set array sizes
        unitUpgrades  = new UnitUpgrade[numUnitUpgrades];
        classUpgrades = new ClassUpgrade[numClassUpgrades];

        //Create inital upgrades
        InitUnitUpgrade();
    }
Exemple #9
0
    //Initilize
    public void Initialize(
        STDMath math, Generator gen, Assets asset, SelectionScript selec,
        bool active, bool defense, bool ai
        )
    {
        //assign external variables
        map         = gen;
        assetHolder = asset;
        selector    = selec;
        stdMath     = math;
        Random.InitState(stdMath.seed);
        guiCon = GameObject.Find("UI").GetComponent <GUIDriver> ();

        //Sets living or AI player, and defense or offense
        activePlayer = active;
        isAI         = ai;
        onDefense    = defense;

        //Create overlord upgrades
        upgrades = this.gameObject.AddComponent <OverlordUpgrade>();
        upgrades.Init(active, math, this, gen);



        //initialzies per playertype
        if (active)
        {
            quickKeys          = selec.gameObject.GetComponent <QuickKeys>();
            quickKeys.overlord = this;

            //Initialize Gui
            guiCon.InitGUI(this);

            controls = gen.GetControls();
            controls.Init(math, this, gen);

            //set default unit layer
            defualtLayer        = 11;
            defualtLayerOutline = 29;
        }

        //set GameTime starting
        gameTime = Time.time;
    }
Exemple #10
0
    public void InitTile(STDMath stdmath, Generator gen,
                         int tiletype, int prime, int tilewidth, int sq, Vector2 maploc,
                         float[,] noisemap, Vector2 noisestart,
                         bool useAssets, int numassets, GameObject[] assets,
                         Material mat
                         )
    {
        //initialize variables
        stdMath   = stdmath;
        tileType  = tiletype;
        primeType = prime;
        tileWidth = tilewidth;
        sqrt      = sq;
        MapLoc    = maploc;
        TileLoc   = this.gameObject.transform.position;

        noise      = noisemap;
        noiseStart = noisestart;

        numAssets  = numassets;
        tileAssets = assets;

        //Initialize mesh variables
        mr          = this.gameObject.GetComponent <MeshRenderer>();
        mf          = this.gameObject.GetComponent <MeshFilter> ();
        mr.material = mat;

        //modeify terrain
        SetTerrain();

        //set assets
        if (useAssets)
        {
            SetAssets();
        }

        //Create Box Collider
        CreateCollider();
    }
Exemple #11
0
    /* ===================================================================================================================================
     *
     *                                  Core Functions
     *                          Functions used to initialize and get updates
     *=================================================================================================================================== */


    // Use this for initialization
    public void InitMovement(
        Generator mainmap, UnitAssets ass,
        float speed, float[] costs, Vector2 loc,
        CharacterController mainController
        )
    {
        //initialize external classes
        assets   = ass;
        mainMap  = mainmap;
        tileMap  = mainMap.GetMap();
        stdMath  = mainMap.stdMath;
        currTile = mainMap.GetTile(loc).GetComponent <Tile> ();
        mainCon  = mainController;
        Random.InitState(stdMath.seed);

        //Initialize base stats
        baseSpeed = speed;
        moveCosts = costs;

        //Initialize private
        curPos = this.gameObject.transform.position;
        mapLoc = loc;

        //Initialize Formation
        //  unitFormation = this.gameObject.AddComponent<UnitFormation>();
        // unitFormation.Init(stdMath);


        //initilaize path renderer
        pathRenderer = new GameObject().AddComponent <LineRenderer>();
        pathRenderer.gameObject.name             = "Path Renderer";
        pathRenderer.gameObject.transform.parent = this.gameObject.transform;
        pathRenderer.gameObject.layer            = 28;
        pathRenderer.shadowCastingMode           = UnityEngine.Rendering.ShadowCastingMode.Off;
        pathRenderer.receiveShadows = false;
        pathRenderer.useWorldSpace  = true;
        pathRenderer.SetPosition(0, this.gameObject.transform.position);
    }
Exemple #12
0
    private int mask = 0;       //System.Convert.ToInt32("01101000000",2);

    //initialize
    void Start()
    {
        //initlize seleciton
        //selection = this.gameObject.AddComponent (typeof(SelectionScript)) as SelectionScript;

        //create selection mask
        int[] masks = { 10, 11, 12, 13 };

        //combine masks
        for (int i = 0; i < masks.Length; ++i)
        {
            int m = 1 << masks [i];
            mask = mask | m;
        }

        //selection.InitSelection (mask, cam);

        //set stdMath
        stdMath = cam.transform.parent.parent.GetComponent <STDMath>() as STDMath;


        //Set up custom cursor
        //Cursor.visible = false;
    }
Exemple #13
0
    //Initialize
    public void Init(STDMath std)
    {
        //Set Cross class
        stdMath = std;
        Debug.Log(this);
        maxUnits = assets.unitInfo.Length;

        //set number of formation postions
        formationPositions = new Vector3[maxUnits];

        //initialize formation vectors
        formationVectors = new Vector3[5, 5];
        for (int y = 0; y < 5; ++y)
        {
            for (int x = 0; x < 5; ++x)
            {
                //create new vector with 0 center and +/- 2 deviance
                Vector3 v = new Vector3((2 * (x - 2)), 0, (2 * (y - 2)));
                formationVectors[y, x] = v;
            }
        }

        //set default formation
    }
Exemple #14
0
 //Initialize
 public void Init(STDMath std, Generator gen, Unit u)
 {
     stdMath = std;
     map     = gen;
     unit    = u;
 }