Beispiel #1
0
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     mCharacter   = owner as CharacterOther;
     mData        = mCharacter.getCharacterData();
     mAIBaseSpeed = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_AI_BASE_SPEED);
 }
Beispiel #2
0
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     if (!(mComponentOwner is Transformable))
     {
         logError("ComponentTrackTarget can only add to Transformable");
     }
 }
Beispiel #3
0
 //--------------------------------------------------------------------------------------------------------------------------------------------
 // 进度条
 #region 进度条
 public static void SLIDER(ComponentOwner slider, float value)
 {
     CMD(out CommandWindowSlider cmd, false);
     cmd.mStartValue  = value;
     cmd.mTargetValue = value;
     cmd.mOnceLength  = 0.0f;
     pushCommand(cmd, slider);
 }
Beispiel #4
0
 public static void SLIDER(ComponentOwner slider, float start, float target, float time)
 {
     CMD(out CommandWindowSlider cmd, false);
     cmd.mStartValue  = start;
     cmd.mTargetValue = target;
     cmd.mOnceLength  = time;
     cmd.mKeyframe    = KEY_FRAME.ZERO_ONE;
     pushCommand(cmd, slider);
 }
 public override void resetProperty()
 {
     base.resetProperty();
     mComponentOwner  = null;
     mType            = null;
     mIgnoreTimeScale = false;
     mDefaultActive   = false;
     mActive          = true;
 }
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentRotateSpeed component = obj.getComponent(out component);

        // 停止其他旋转组件
        obj.breakComponent <IComponentModifyRotation>(component.GetType());
        component.setActive(true);
        component.startRotateSpeed(mStartAngle, mRotateSpeed, mRotateAcceleration);
    }
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentRotateFixed component = obj.getComponent(out component);

        // 停止其他旋转组件
        obj.breakComponent <IComponentModifyRotation>(component.GetType());
        component.setActive(mActive);
        component.setFixedEuler(mFixedEuler);
    }
Beispiel #8
0
 List <GameComponent> mChildComponentList;                                   // 该组件下的子组件列表,保存了子组件之间的顺序
 public GameComponent(Type type, string name)
 {
     mType               = type;
     mName               = name;
     mComponentOwner     = null;
     mActive             = true;
     mLockOneFrame       = false;
     mParent             = null;
     mChildComponentMap  = new Dictionary <string, GameComponent>();
     mChildComponentList = new List <GameComponent>();
 }
Beispiel #9
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            var transform = ComponentOwner.GetComponent <Transform>();
            var position  = transform.Position + ComponentOwner.ParentPosition;

            spriteBatch.Draw(
                Sprite,
                position,
                Color.White
                );
            base.Draw(spriteBatch);
        }
Beispiel #10
0
    public override void execute()
    {
        ComponentOwner        obj       = mReceiver as ComponentOwner;
        WindowComponentSlider component = obj.getComponent(out component);

        component.setTremblingCallback(mTremblingCallBack);
        component.setTrembleDoneCallback(mTrembleDoneCallBack);
        component.setActive(true);
        component.setStartValue(mStartValue);
        component.setTargetValue(mTargetValue);
        component.play(mTremblingName, mLoop, mOnceLength, mOffset, mFullOnce, mAmplitude);
    }
	public override void execute()
	{
		ComponentOwner obj = mReceiver as ComponentOwner;
		ComponentTrackTargetNormal component = obj.getComponent(out component);
		// 停止其他移动组件
		obj.breakComponent<IComponentModifyPosition>(component.GetType());
		component.setActive(true);
		component.setSpeed(mSpeed);
		component.setTargetOffset(mOffset);
		component.setTrackingCallback(mDoingCallback);
		component.setMoveDoneTrack(mTarget, mDoneCallback);
	}
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentMoveCurve component = obj.getComponent(out component);

        // 停止其他移动组件
        obj.breakComponent <IComponentModifyPosition>(component.GetType());
        component.setTremblingCallback(mTremblingCallBack);
        component.setTrembleDoneCallback(mTrembleDoneCallBack);
        component.setActive(true);
        component.setKeyPosList(mPosList);
        component.play(mName, mLoop, mOnceLength, mOffset, mFullOnce, mAmplitude);
    }
Beispiel #13
0
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentScale component = obj.getComponent(out component);

        // 停止其他缩放组件
        obj.breakComponent <IComponentModifyScale>(component.GetType());
        component.setTremblingCallback(mTremblingCallBack);
        component.setTrembleDoneCallback(mTrembleDoneCallBack);
        component.setActive(true);
        component.setStartScale(mStartScale);
        component.setTargetScale(mTargetScale);
        component.play(mName, mLoop, mOnceLength, mOffset, mFullOnce, mAmplitude);
    }
    public override void execute()
    {
        ComponentOwner       obj       = mReceiver as ComponentOwner;
        WindowComponentAlpha component = obj.getComponent(out component);

        // 停止其他相关组件
        obj.breakComponent <IComponentModifyAlpha>(component.GetType());
        component.setTremblingCallback(mTremblingCallBack);
        component.setTrembleDoneCallback(mTrembleDoneCallBack);
        component.setActive(true);
        component.setStartAlpha(mStartAlpha);
        component.setTargetAlpha(mTargetAlpha);
        component.play(mName, mLoop, mOnceLength, mOffset, mFullOnce, mAmplitude);
    }
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentLerpPosition component = obj.getComponent(out component);

        // 停止其他移动组件
        obj.breakComponent <IComponentModifyPosition>(component.GetType());
        component.setLerpingCallback(mLerpingCallBack);
        component.setLerpDoneCallback(mLerpDoneCallBack);
        component.setActive(true);
        component.setTargetPosition(mTargetPosition);
        component.setLerpSpeed(mLerpSpeed);
        component.play();
    }
Beispiel #16
0
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        MovableObjectComponentAudio component = obj.getComponent(out component);

        component.setActive(true);
        string soundName = mSound != SOUND_DEFINE.SD_MAX ? mAudioManager.getAudioName(mSound) : mSoundFileName;

        if (mUseVolumeCoe)
        {
            mVolume *= mAudioManager.getVolumeScale(mSound);
        }
        component.play(soundName, mLoop, mVolume);
    }
Beispiel #17
0
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentMovePath component = obj.getComponent(out component);

        // 停止其他移动组件
        obj.breakComponent <IComponentModifyPosition>(component.GetType());
        component.setTremblingCallback(mDoingCallBack);
        component.setTrembleDoneCallback(mDoneCallBack);
        component.setActive(true);
        component.setValueKeyFrame(mValueKeyFrame);
        component.setSpeed(mSpeed);
        component.setValueOffset(mValueOffset);
        component.play(mLoop, mOffset, mFullOnce);
    }
    public override void execute()
    {
        ComponentOwner obj = mReceiver as ComponentOwner;
        TransformableComponentRotate component = obj.getComponent(out component);

        // 停止其他旋转组件
        obj.breakComponent <IComponentModifyRotation>(component.GetType());
        component.setTremblingCallback(mTremblingCallBack);
        component.setTrembleDoneCallback(mTrembleDoneCallBack);
        component.setActive(true);
        if (mRandomOffset)
        {
            mOffset = randomFloat(0.0f, mOnceLength);
        }
        component.setTargetRotation(mTargetRotation);
        component.setStartRotation(mStartRotation);
        component.play(mName, mLoop, mOnceLength, mOffset, mFullOnce, mAmplitude);
    }
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     mCharacter = owner as CharacterOther;
     if (mCharacter == null)
     {
         UnityUtility.logError("CharacterBikePhysics can only attach to CharacterOther!");
     }
     mData                = mCharacter.getCharacterData();
     mNormalFriction      = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_NORMAL_FRICTION);
     mMinUphillAngle      = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MIN_UPHILL_ANGLE);
     mMaxUphillAngle      = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MAX_UPHILL_ANGLE);
     mMinDownhillAngle    = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MIN_DOWNHILL_ANGLE);
     mMaxDownhillAngle    = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MAX_DOWNHILL_ANGLE);
     mMinUphillFriction   = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MIN_UPHILL_FRICTION);
     mMaxUphillFriction   = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MAX_UPHILL_FRICTION);
     mMinDownhillFriction = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MIN_DOWNHILL_FRICTION);
     mMaxDownhillFriction = mGameConfig.getFloatParam(GAME_DEFINE_FLOAT.GDF_MAX_DOWNHILL_FRICTION);
 }
Beispiel #20
0
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     // 通知子类设置自己的音效类型
     setSoundOwner();
     // 如果音效还未加载,则加载所有音效,此处只是注册
     if (mSoundDefineMap.Count == 0)
     {
         int dataCount = mDataBase.getDataCount(DATA_TYPE.DT_GAME_SOUND);
         for (int i = 0; i < dataCount; ++i)
         {
             DataGameSound soundData = mDataBase.queryData(DATA_TYPE.DT_GAME_SOUND, i) as DataGameSound;
             string        soundName = BinaryUtility.bytesToString(soundData.mSoundFileName);
             string        audioName = StringUtility.getFileNameNoSuffix(soundName, true);
             mSoundDefineMap.Add((SOUND_DEFINE)(soundData.mSoundID), audioName);
             mAudioManager.createAudio(soundName, false);
         }
     }
 }
Beispiel #21
0
 // 建立与拥有者和父组件的联系,使该组件成为拥有者中的一个组件,该组件下的所有子组件也会重建与拥有者的联系,父子关系仍然存在
 public virtual void attachOwnerParentComponent(ComponentOwner owner, GameComponent parent, int childPos)
 {
     // 先建立与父组件的联系,避免在建立与组件拥有者的联系时被当作第一级组件
     if (parent != null && mParent == null)
     {
         parent.addChild(this);
         parent.moveChildPos(this, childPos);
     }
     if (owner != null && mComponentOwner == null)
     {
         mComponentOwner = owner;
         mComponentOwner.notifyComponentAttached(this);
         // 使自己所有的子组件都建立与拥有者的联系
         int childCount = mChildComponentList.Count;
         for (int i = 0; i < childCount; ++i)
         {
             mChildComponentList[i].attachOwnerParentComponent(owner, null, -1);
         }
     }
 }
Beispiel #22
0
    // 断开与拥有者和父组件的联系,使该组件成为一个独立的组件,该组件下的所有子组件也会断开与拥有者的联系,但是父子关系仍然存在
    // detachOwnerOnly表示是否只断开与拥有者的联系,不断开组件之间的父子关系,外部使用时一般填false
    public virtual void detachOwnerParentComponent(bool detachOwnerOnly = false)
    {
        if (mComponentOwner != null)
        {
            mComponentOwner.notifyComponentDetached(this);
            mComponentOwner = null;
        }
        // 如果不是只断开与组件拥有者的联系,则还需要断开与父组件的联系
        if (!detachOwnerOnly && mParent != null)
        {
            mParent.notifyChildDetached(this);
            setParentComponent(null);
        }
        // 使自己所有的子组件都断开与拥有者的联系,但是不能打断子组件的父子关系
        int childCount = mChildComponentList.Count;

        for (int i = 0; i < childCount; ++i)
        {
            mChildComponentList[i].detachOwnerParentComponent(true);
        }
    }
 public void OnAttached <TComponent>(ComponentOwner owner, TComponent component) where TComponent : class, ISingleOwnerComponent
 {
     if (owner is null)
     {
         ThrowNullArg();
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     mPlayer = owner as Character;
 }
Beispiel #25
0
 void IComponent.OnDetached(ComponentOwner owner) => _core.OnDetached(owner, this);
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     mTimer.init(1.0f, 1.0f);
 }
Beispiel #27
0
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
 }
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     mWindow = mComponentOwner as myUIObject;
 }
Beispiel #29
0
 public override void init(ComponentOwner owner)
 {
     base.init(owner);
     initSwitch();
     mCamera = mComponentOwner as GameCamera;
 }
 public virtual void init(ComponentOwner owner)
 {
     mComponentOwner = owner;
 }