Beispiel #1
0
        public uint CreateAvatarMirror(BaseMonoAvatar owner, Vector3 initPos, Vector3 initDir, string AIName, float hpRatio)
        {
            BaseMonoAvatar component = ((GameObject)UnityEngine.Object.Instantiate(Miscs.LoadResource <GameObject>(AvatarData.GetPrefabResPath(owner.AvatarTypeName, true), BundleType.RESOURCE_FILE), initPos, Quaternion.LookRotation(initDir))).GetComponent <BaseMonoAvatar>();

            component.Init(false, Singleton <RuntimeIDManager> .Instance.GetNextRuntimeID(3), owner.AvatarTypeName, owner.EquipedWeaponID, initPos, initDir, false);
            this.RegisterAvatar(component, false, false, false);
            AvatarMirrorActor actor = Singleton <EventManager> .Instance.CreateActor <AvatarMirrorActor>(component);

            actor.InitFromAvatarActor(Singleton <EventManager> .Instance.GetActor <AvatarActor>(owner.GetRuntimeID()), hpRatio);
            actor.PostInit();
            component.TriggerSwitchIn();
            BTreeAvatarAIController activeAIController = component.GetActiveAIController() as BTreeAvatarAIController;

            if (string.IsNullOrEmpty(AIName))
            {
                activeAIController.SetActive(false);
            }
            else
            {
                activeAIController.ChangeBehavior(AIName);
                component.ForceUseAIController();
            }
            return(component.GetRuntimeID());
        }