Esempio n. 1
0
    public void Init(Vector3 position)
    {
        CreateSelf(position);

        // 初始化 BehaviorTree 实例,将 (BaseSprite)this传递进去
        _bt = new BTConcrete(this, long.MaxValue, _btConfigFileName);
        // 更新环境变量 BTConstant.IsSurvial 的值 为 true
        BTBase.UpdateParameter(BTConstant.IsSurvial, true);
        // 更新环境变量 BTConstant.Energy 的值为 Energy() 返回的结果
        BTBase.UpdateParameter(BTConstant.Energy, Energy());
    }
Esempio n. 2
0
    public void Init(Vector3 position)
    {
        GameObject go = Resources.Load <GameObject>("BaseSprite");

        SpriteGameObject      = GameObject.Instantiate <GameObject>(go);
        SpriteGameObject.name = "BaseSprite";
        SpriteGameObject.transform.localScale = Vector3.one;
        SpriteGameObject.transform.position   = position;

        Transform textTr = SpriteGameObject.transform.Find("Text");

        _textMesh = textTr.gameObject.GetComponent <TextMesh>();

        _bt = new BTConcrete(this, long.MaxValue, _btConfigFileName);
        _bt.UpdateParameter(BTConstant.IsSurvial, true);

        BTBase.UpdateParameter(BTConstant.Energy, Energy());
    }