示例#1
0
    /// <summary>
    /// Creates a creep, the entities that seek out the power core
    /// </summary>
    /// <param name="type"></param>
    /// <param name="spot"></param>
    /// <returns></returns>
    public Creep CreateCreep(Creep.CreepTypes type, Vector2 spot)
    {
        GameObject go = _CreateObject(spot);

        go.name  = "Creep_" + type;
        go.layer = 10;
        go.transform.localScale *= 0.5f;
        //
        Creep c = go.AddComponent <Creep>();

        c.ChangeType(type); // *** Automatically sets the sprite!
        c.rb.constraints = RigidbodyConstraints2D.FreezeRotation;


        return(c);
    }