Example #1
0
    void Awake()
    {
        // load animation
        foreach (string path in prefab.animationPath)
        {
            AnimationObject obj = GameObject.Find(path).GetComponent <AnimationObject>();
            animationList.Add(obj);
        }

        //load trigger
        foreach (string path in prefab.triggerPath)
        {
            TriggerObject obj = GameObject.Find(path).GetComponent <TriggerObject>();
            triggerList.Add(obj);
        }

        // init sprite list
        spriteList = new List <MySprite>();
        MySprite sprite1 = GameObject.Find("Sprite1").GetComponent <MySprite>();
        MySprite sprite2 = GameObject.Find("Sprite2").GetComponent <MySprite>();

        spriteList.Add(sprite1);
        spriteList.Add(sprite2);
        int id = data.playerId;

        mainSprite = GameObject.Find("Sprite" + id).GetComponent <MySprite>();
        mainSprite.SetMainPlayer();

        // init id
        rpc.SetMainSpriteId(mainSprite.Id);
        rpc.initPlayerList();
        rpc.SetStatus("Id", mainSprite.Id);
    }