Example #1
0
    void MakeNewClone(List <List <Command> > CommandImprint)
    {
        GameObject NewClone = Instantiate(ClonePrefab, transform.position, transform.rotation, transform);

        Clones.Add(NewClone);
        NewClone.name = "PlayerClone " + CloneNum;
        Player NewP = NewClone.GetComponent <Player>();

        CommandProcessor NewCP = NewClone.GetComponent <CommandProcessor>();

        foreach (List <Command> a in CommandImprint)
        {
            foreach (Command b in a)
            {
                b.Player = NewP;
            }
            NewCP.Commands.Add(a);
        }

        NewCP.ConfirmCommandsForSelf();
        Physics2D.IgnoreCollision(NewP.BodyCollider, PlayerScript.BodyCollider);
        foreach (GameObject a in Clones)
        {
            Physics2D.IgnoreCollision(NewP.BodyCollider, a.GetComponent <Player>().BodyCollider);
        }
        EquipNextWeapon(NewClone);
        CloneNum++;
    }