Ejemplo n.º 1
0
 // Start is called before the first frame upda
 void Awake()
 {
     if (instance)
     {
         Destroy(this);
     }
     instance = this;
 }
Ejemplo n.º 2
0
    void Start()
    {
        ss = this.GetComponent <ScreenShake>();
        Color32 red    = new Color32(253, 87, 87, 255);
        Color32 blue   = new Color32(74, 109, 226, 255);
        Color32 green  = new Color32(10, 157, 86, 255);
        Color32 purple = new Color32(202, 88, 253, 255);

        colors.Add(blue);
        colors.Add(green);
        colors.Add(purple);
        colors.Add(red);
        CharacterManager cm = FindObjectOfType <CharacterManager>();

        if (cm != null)
        {
            p1.colorIndex     = cm.p1colorIndex;
            p2.colorIndex     = cm.p2colorIndex;
            p1.CharacterIndex = cm.p1characterIndex;
            p2.CharacterIndex = cm.p2characterIndex;
            p1.sr.sprite      = cm.CharacterSet[p1.CharacterIndex][p1.colorIndex];
            p2.sr.sprite      = cm.CharacterSet[p2.CharacterIndex][p2.colorIndex];
            p1.teamColor      = colors[p1.colorIndex];
            p2.teamColor      = colors[p2.colorIndex];

            p1.initStats();
            p2.initStats();
        }
        else if (cm == null)
        {
            MPCharacterManager MPcm = FindObjectOfType <MPCharacterManager>();
            p1startPos        = new Vector3(-4, 3, 0);
            p2startPos        = new Vector3(4, 3, 0);
            p1.colorIndex     = MPcm.p1colorIndex;
            p2.colorIndex     = MPcm.p2colorIndex;
            p3.colorIndex     = MPcm.p3colorIndex;
            p4.colorIndex     = MPcm.p4colorIndex;
            p1.CharacterIndex = MPcm.p1characterIndex;
            p2.CharacterIndex = MPcm.p2characterIndex;
            p3.CharacterIndex = MPcm.p3characterIndex;
            p4.CharacterIndex = MPcm.p4characterIndex;
            p1.sr.sprite      = MPcm.CharacterSet[p1.CharacterIndex][p1.colorIndex];
            p2.sr.sprite      = MPcm.CharacterSet[p2.CharacterIndex][p2.colorIndex];
            p3.sr.sprite      = MPcm.CharacterSet[p3.CharacterIndex][p3.colorIndex];
            p4.sr.sprite      = MPcm.CharacterSet[p4.CharacterIndex][p4.colorIndex];
            p1.teamColor      = colors[p1.colorIndex];
            p2.teamColor      = colors[p2.colorIndex];
            p3.teamColor      = colors[p3.colorIndex];
            p4.teamColor      = colors[p4.colorIndex];

            p1.initStats();
            p2.initStats();
            p3.initStats();
            p4.initStats();
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Update is called every frame, if the MonoBehaviour is enabled.
    /// </summary>

    public void myStart()
    {
        if (CharacterManager.instance != null)
        {
            cm = CharacterManager.instance;
        }
        else
        {
            MPcm = MPCharacterManager.instance;
        }
        loadImage();
        print(name);
    }