Exemple #1
0
 public void argInit(List <ActionReq> actions, PlayBoard2D pb, CellStruct[,] pGrid, CellStruct[,] eGrid)
 {
     this.actions = actions;
     this.pb      = pb;
     this.pGrid   = pGrid;
     this.eGrid   = eGrid;
 }
Exemple #2
0
    void Start()
    {
        //Debug.Log("PlayerConnectionObj Start. Local: " + isLocalPlayer.ToString());
        UIController.instance.DBPWrite("Player " + this.playerId.ToString() + " joined!");
        if (isServer)          //We're the object on the server, need to link up to logic core
        //Debug.Log("pco init: This is the server");
        {
            GameObject logicCoreObj = GameObject.FindGameObjectWithTag("LogicCore");
            if (logicCoreObj != null)
            {
                this.lc = logicCoreObj.GetComponent <LogicCore>();
                //Debug.Log("pco init: Logic core found by server instance of player: " + this.lc.ToString());
            }
            //else
            //Debug.Log("pco init: Found no logic Core server instance of player");
        }
        if (isLocalPlayer)          // We're the local player, need to grab out grids, set their owner, set color
        //Debug.Log("pco init: This is the local player");
        //distinguish name? bad idea?
        {
            gameObject.name = gameObject.name + "Local";
            //Find our UIC and do it's setup
            UIController.instance = GameObject.FindGameObjectWithTag("UIGroup").GetComponent <UIController>();
            UIController.instance.DBPWrite("Player " + this.playerId.ToString() + " joined!");
            //Find our local playboard, and get grids
            this.pb      = GameObject.FindGameObjectWithTag("PlayBoard").GetComponent <PlayBoard2D>();       // Find the playboard in the scene
            this.pb.pobj = this;
            //this.ip = GameObject.FindGameObjectWithTag("InputProcessor").GetComponent<InputProcessor>();
            InputProcessor.instance.RegisterReport(this);

            this.isReady = true;             //Now we can recieve RPC's ready's set
            this.CmdRequestGameStateUpdate();
            this.CmdRequestGridUpdate();
        }
    }
    public override void Init(List <ActionReq> actions, PlayBoard2D pb, CellStruct[,] pGrid, CellStruct[,] eGrid)
    {
        base.argInit(actions, pb, pGrid, eGrid);
        projectile     = GetComponent <SpriteRenderer>();
        orig_z         = transform.position.z;
        orig_scale     = transform.localScale;
        hitParticle    = transform.Find("HitParticle").GetComponent <ParticleSystem>();
        trailParticle  = GetComponent <ParticleSystem>();
        rock           = transform.Find("Rock").gameObject;
        rockSpriteRend = rock.GetComponent <SpriteRenderer>();
        ActionReq  a    = actions[0];
        GameGrid2D gg   = a.t == pb.pobj.playerId ? pb.playerGrid : pb.enemyGrid; // Select grid to get coord's
        Cell2D     cell = gg.GetCell(a.loc[0]);

        this.startpos           = a.p == pb.pobj.playerId ? pb.playerShotOrig : pb.enemyShotOrig;
        this.transform.position = startpos;
        this.endpos             = cell.transform.position;
    }
Exemple #4
0
    public override void Init(List <ActionReq> actions, PlayBoard2D pb, CellStruct[,] pGrid, CellStruct[,] eGrid)
    {
        base.argInit(actions, pb, pGrid, eGrid);
        float setDelay = 0;

        foreach (ActionReq ar in actions)
        {
            GameObject     go   = Instantiate(fireRes);
            FireResolution fres = go.GetComponent <FireResolution>();
            fres.Init(new List <ActionReq>()
            {
                ar
            }, pb, pGrid, eGrid);
            fres.delay = setDelay;
            setDelay  += delay;
            shots.Add(fres);
        }
    }
Exemple #5
0
 public abstract void Init(List <ActionReq> actions, PlayBoard2D pb, CellStruct[,] pGrid, CellStruct[,] eGrid);
Exemple #6
0
 public override void Init(List <ActionReq> actions, PlayBoard2D pb, CellStruct[,] pGrid, CellStruct[,] eGrid)
 {
     base.argInit(actions, pb, pGrid, eGrid);
 }