Пример #1
0
 protected virtual void Start()
 {
     snm    = GetComponent <SocketNetworkManager>();
     canvas = GameObject.Find("Canvas").GetComponent <Canvas>();
     rb     = GetComponent <Rigidbody2D>();
     render = GetComponent <SpriteRenderer>();
     health = GetComponent <Health>();
     rb.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
     direction                = new Vector2(0, 0);
     angle                    = 0.0f;
     forces                   = new List <Vector2>();
     healthbar                = GameObject.FindWithTag("P" + healthbar_id + "-health");
     interfaceplayertext      = GameObject.FindWithTag("P" + healthbar_id + "-name").GetComponent <Text>();
     healthbarback            = GameObject.FindWithTag("P" + healthbar_id + "-healthbg");
     healthedge               = GameObject.FindWithTag("P" + healthbar_id + "-hp-edge");
     interfaceplayertext.text = "Player " + healthbar_id;
     icon = GameObject.FindWithTag("P" + healthbar_id + "-icon");
     //icon.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>(dict[plclass]);
     healthbarsize  = healthbar.transform.localScale;
     hbarupdatetime = 0;
     knocked        = 0;
     realvelocity   = new Vector2(0, 0);
     clicked        = false;
     hit            = 0;
 }
Пример #2
0
    protected virtual void Start()
    {
        snm    = GetComponent <SocketNetworkManager>();
        canvas = GameObject.Find("Canvas").GetComponent <Canvas>();
        rb     = GetComponent <Rigidbody2D>();
        render = GetComponent <SpriteRenderer>();
        health = GetComponent <Health>();
        rb.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
        direction                = new Vector2(0, 0);
        angle                    = 0.0f;
        forces                   = new List <Vector2>();
        healthbar                = GameObject.FindWithTag("Health-bar");
        healthbarback            = GameObject.FindWithTag("Health-bar-background");
        interfaceplayertext      = GameObject.FindWithTag("Player-text").GetComponent <Text>();
        interfaceplayertext.text = "You: base";
        icon = GameObject.FindWithTag("icon");
        Debug.Log(dict[plclass]);
        icon.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(dict[plclass]);
        healthbarsize  = healthbar.transform.localScale;
        hbarupdatetime = 0;
        knocked        = 0;
        realvelocity   = new Vector2(0, 0);
        clicked        = false;
        hit            = 0;

        /* ABILITIES */
        GameObject[] icons = GameObject.FindGameObjectsWithTag("ability-icons");
        Array.Sort(icons, CompareIcons);

        lmbAbilityInit();
        shiftAbilityInit();
        rmbAbilityInit();
        eAbilityInit();
        qAbilityInit();

        List <cooldown> cds = new List <cooldown>();

        glcd     = new cooldown(LMB_NAME, GLOBAL_CD, "LMB", icons[0]);
        rmbcd    = new cooldown(RMB_NAME, RMB_CD, "RMB", icons[1]);
        lshiftcd = new cooldown(SHIFT_NAME, SHIFT_CD, "LShift", icons[2]);
        ecd      = new cooldown(E_NAME, E_CD, "e", icons[3]);
        qcd      = new cooldown(Q_NAME, Q_CD, "q", icons[4]);
        cds.Add(glcd);
        cds.Add(lshiftcd);
        cds.Add(rmbcd);
        cds.Add(ecd);
        cds.Add(qcd);

        /* SET CD TEXT */
        cds.ForEach(delegate(cooldown c){
            Text t = c.go.GetComponentInChildren(typeof(Text)) as Text;
            t.text = c.key;
        });

        /* GLOBAL CD */
        globalcd = new cooldown(GLOBAL_CD, icons);
        cds.Add(globalcd);
        StartCoroutine(cdUpdater(cds));
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     snm = GetComponent <SocketNetworkManager>();
     MenuPanel.SetActive(true);
     LobbySelectPanel.SetActive(false);
     LobbyCreatePanel.SetActive(false);
     ControlsPanel.SetActive(false);
     droplist = dropdown.GetComponent <Dropdown>();
 }
 void Start()
 {
     snm = new SocketNetworkManager();
     clToObj["Archer"] = buttonArcher;
     clToObj["Knight"] = buttonKnight;
     clToObj["Priest"] = buttonPriest;
     clToObj["None"]   = null;
     plord[SocketNetworkManager.id] = 0;
     foreach (KeyValuePair <string, newPly> a in SocketNetworkManager.newplayers)
     {
         Debug.Log("update from start");
         if (a.Value.theirid != SocketNetworkManager.id)
         {
             StartCoroutine(UpdateClassHandle(a.Value.theirid, a.Value._plclass));
         }
     }
 }
Пример #5
0
 private void Start()
 {
     snm     = GetComponent <SocketNetworkManager>();
     textbox = this.gameObject.GetComponent <Text>();
     if (SocketNetworkManager.isHost)
     {
         snm.logText("You are host");
         snm.logText("Waiting for more players (1/3)");
     }
     else
     {
         snm.logText("Waiting for more players (" + (SocketNetworkManager.numberofplayers + 1) + "/3)");
         if (SocketNetworkManager.numberofplayers == 3)
         {
             snm.logText("Ready to start");
         }
     }
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     snm      = GetComponent <SocketNetworkManager>();
     t        = GetComponent <Transform>();
     losetext = GameObject.FindWithTag("lose-text");
     losetext.SetActive(false);
     wintext = GameObject.FindWithTag("win-text");
     wintext.SetActive(false);
     playerInitPos.Add(new Vector2(2, -2));
     playerInitPos.Add(new Vector2(0, -2));
     playerInitPos.Add(new Vector2(-2, -2));
     playerClasses.Add("ArcherOP");
     playerClasses.Add("KnightOP");
     playerClasses.Add("PriestOP");
     if (SocketNetworkManager.isHost)
     {
         StartGameButton.SetActive(true);
     }
 }
Пример #7
0
 // Use this for initialization
 void Start()
 {
     snm           = GetComponent <SocketNetworkManager>();
     canvas        = GameObject.Find("Canvas").transform;
     state         = true;
     animation     = this.GetComponent <Animation>();
     rb            = GetComponent <Rigidbody2D>();
     health        = GetComponent <Health>();
     render        = GetComponent <SpriteRenderer>();
     imageO        = gameObject.transform.GetChild(2).gameObject;
     image         = (RectTransform)gameObject.transform.GetChild(2);
     daoguang      = gameObject.transform.GetChild(0).gameObject;
     bossname      = GameObject.FindWithTag("Boss-name").GetComponent <Text>();
     healthbar     = GameObject.FindWithTag("Boss-health");
     healthbarbg   = GameObject.FindWithTag("Boss-healthbh");
     hit           = 0;
     healthbarsize = healthbar.transform.localScale;
     gameObject.transform.parent = canvas;
     gameObject.GetComponent <RectTransform>().localScale    = new Vector3(25.0f, 25.0f, 25.0f);
     gameObject.GetComponent <RectTransform>().localPosition = Vector3.one;
     prevPos = transform.position;
 }
Пример #8
0
 // Use this for initialization
 void Start()
 {
     snm           = GetComponent <SocketNetworkManager>();
     canvas        = GameObject.Find("Canvas").transform;
     state         = true;
     isMove        = true;
     isstone       = false;
     animation     = this.GetComponent <Animation>();
     rb            = GetComponent <Rigidbody2D>();
     health        = GetComponent <Health>();
     render        = GetComponent <SpriteRenderer>();
     imageO        = gameObject.transform.GetChild(2).gameObject;
     bossname      = GameObject.FindWithTag("Boss-name").GetComponent <Text>();
     healthbar     = GameObject.FindWithTag("Boss-health");
     healthbarbg   = GameObject.FindWithTag("Boss-healthbh");
     hit           = 0;
     healthbarsize = healthbar.transform.localScale;
     gameObjects   = GameObject.FindGameObjectsWithTag("Player");
     player        = GameObject.FindWithTag("Player");//delete after merge
     gameObject.transform.parent = canvas;
     gameObject.GetComponent <RectTransform>().localScale    = new Vector3(25.0f, 25.0f, 25.0f);
     gameObject.GetComponent <RectTransform>().localPosition = Vector3.one;
 }
Пример #9
0
 void Start()
 {
     socketIOManager = gameObject.GetComponent<SocketNetworkManager>();
 }
Пример #10
0
 // Use this for initialization
 void Start()
 {
     rb        = GetComponent <Rigidbody2D>();
     knockback = 1;
     snm       = new SocketNetworkManager();
 }
 // Use this for initialization
 void Start()
 {
     swordcoll = GetComponent <EdgeCollider2D>();
     snm       = new SocketNetworkManager();
 }