示例#1
0
    protected virtual void buildObject(int level)
    {
        _sprite = gameObject.GetComponent <tk2dAnimatedSprite>();

        settings = graphicSettings[level];

        level = level;

        ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, settings.defaultSprite);
        if (settings.animationAtlas != "")
        {
            ContentManager.instance.precacheAnimation(_sprite, settings.animationAtlas);
        }

        if (zSort)
        {
            Vector3 position = gameObject.transform.localPosition;
            position.z = (((position.y - _sprite.GetBounds().size.y / 2) * 0.01f)) + .01f;
            gameObject.transform.localPosition = position;
        }

        if (gameObject.GetComponent <BoxCollider>() == null)
        {
            BoxCollider box = gameObject.AddComponent <BoxCollider>();
            box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);
        }
    }
示例#2
0
    public void configure(CustomerDesc desc)
    {
        foreach (CustomerStateDesc stateDesc in desc.stateDescribers)
        {
            _statesMap.Add(stateDesc.state, stateDesc);
        }

        ContentManager.instance.configureObject(_sprite, desc.spriteAtlas, desc.spriteName);
        ContentManager.instance.precacheAnimation(_sprite, desc.animationAtlas);

        BoxCollider box = gameObject.AddComponent <BoxCollider>();

        box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);

        _currentMood   = 100;
        _moodDownSpeed = 60f / desc.moodDownTime;

        setState(CustomerState.INITIAL_STATE);

        _cachedDesc = desc;
    }
    public void configure(CustomerDesc desc)
    {
        _desc = desc;

        _sprite = gameObject.AddComponent<tk2dAnimatedSprite>();
        ContentManager.instance.configureObject(_sprite, _desc.spriteAtlas, _desc.spriteName);
        Debug.Log("Old animation atlas - "+_desc.animationAtlas);
        ContentManager.instance.precacheAnimation(_sprite, _desc.animationAtlas);

        _currentMood = 100;
        _moodDownSpeed = 60f/desc.moodDownTime;

        GameObject tableGO = (GameObject)Instantiate((GameObject)Resources.Load("Prefabs/OrderTable"), Vector3.zero, Quaternion.identity);

        _orderTable = tableGO.GetComponent<OrderTable>();

        BoxCollider box = gameObject.AddComponent<BoxCollider>();
        box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);

        _sprite.Play("hello");

        setState(CustomerStateDeprecated.WAITING_STAND);
    }
示例#4
0
    public void configure(CustomerDesc desc)
    {
        _desc = desc;

        _sprite = gameObject.AddComponent <tk2dAnimatedSprite>();
        ContentManager.instance.configureObject(_sprite, _desc.spriteAtlas, _desc.spriteName);
        Debug.Log("Old animation atlas - " + _desc.animationAtlas);
        ContentManager.instance.precacheAnimation(_sprite, _desc.animationAtlas);

        _currentMood   = 100;
        _moodDownSpeed = 60f / desc.moodDownTime;

        GameObject tableGO = (GameObject)Instantiate((GameObject)Resources.Load("Prefabs/OrderTable"), Vector3.zero, Quaternion.identity);

        _orderTable = tableGO.GetComponent <OrderTable>();

        BoxCollider box = gameObject.AddComponent <BoxCollider>();

        box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);

        _sprite.Play("hello");

        setState(CustomerStateDeprecated.WAITING_STAND);
    }
    void Awake()
    {
        _sprite = gameObject.GetComponentInChildren <tk2dAnimatedSprite>();

        _animations.Add(MoveDirection.DOWN, "run_down");
        _animations.Add(MoveDirection.DOWN_RIGHT, "run_down_right");
        _animations.Add(MoveDirection.RIGHT, "run_right");
        _animations.Add(MoveDirection.UP_RIGHT, "run_up_right");
        _animations.Add(MoveDirection.UP, "run_up");
        _animations.Add(MoveDirection.LEFT, "run_right");
        _animations.Add(MoveDirection.DOWN_LEFT, "run_down_right");
        _animations.Add(MoveDirection.UP_LEFT, "run_up_right");

        _navigator = gameObject.GetComponent <PathNavigator>();
        _navigator.spriteHeight = _sprite.GetBounds().size.y;
    }
    void Awake()
    {
        _sprite = gameObject.GetComponentInChildren<tk2dAnimatedSprite>();

        _animations.Add(MoveDirection.DOWN, "run_down");
        _animations.Add(MoveDirection.DOWN_RIGHT, "run_down_right");
        _animations.Add(MoveDirection.RIGHT, "run_right");
        _animations.Add(MoveDirection.UP_RIGHT, "run_up_right");
        _animations.Add(MoveDirection.UP, "run_up");
        _animations.Add(MoveDirection.LEFT, "run_right");
        _animations.Add(MoveDirection.DOWN_LEFT, "run_down_right");
        _animations.Add(MoveDirection.UP_LEFT, "run_up_right");

        _navigator = gameObject.GetComponent<PathNavigator>();
        _navigator.spriteHeight = _sprite.GetBounds().size.y;
    }
示例#7
0
        public SpriteProxy(GameObject ownerGO, string atlasName, string spriteName)
        {
            _sprite = ownerGO.AddComponent<tk2dAnimatedSprite>();

            ContentManager.instance.configureObject(_sprite, atlasName, spriteName);

            _size = new Vector2(_sprite.GetBounds().size.z, _sprite.GetBounds().size.y);
        }
示例#8
0
    protected virtual void buildObject(int level)
    {
        _sprite = gameObject.GetComponent<tk2dAnimatedSprite>();

        settings = graphicSettings[level];

        level = level;

        ContentManager.instance.configureObject(_sprite, settings.spriteAtlas, settings.defaultSprite);
        if (settings.animationAtlas != "")
            ContentManager.instance.precacheAnimation(_sprite, settings.animationAtlas);

        if (zSort)
        {
            Vector3 position = gameObject.transform.localPosition;
            position.z = (((position.y-_sprite.GetBounds().size.y/2)*0.01f))+.01f;
            gameObject.transform.localPosition = position;
        }

        if (gameObject.GetComponent<BoxCollider>() == null)
        {
            BoxCollider box = gameObject.AddComponent<BoxCollider>();
            box.size = new Vector3(_sprite.GetBounds().size.x, _sprite.GetBounds().size.y, 1);
        }
    }