Пример #1
0
 void Start()
 {
     _PC        = FindObjectOfType(typeof(PlayerController))         as PlayerController;
     _MM        = FindObjectOfType(typeof(miniMapaController)) as miniMapaController;
     _SC        = _PC.GetComponent <ShadowController>();
     mainCamera = Camera.main.transform;
 }
    void Update()
    {
        if (this.ragdoll == null)
            this.ragdoll =
                this.shadowControllers["ShadowRagdollController"]
                as ShadowRagdollController;
        if (this.locomotion == null)
            this.locomotion =
                this.shadowControllers["ShadowLocomotionController"];

        this.dWeight.Tick(Time.deltaTime);

        // Set all of the shadows' root transform positions and orientations
        // to the real root position and orientation
        UpdateCoordinates();

        this.locomotion.ControlledUpdate();
        this.locomotion.Encode(this.locomotionPose);

        // Special management of the ragdoll controller for telling it
        // that it's fully faded out and done falling
        if (this.dWeight.IsMin == true)
            this.ragdoll.IsFalling = false;

        // Reuse the locomotion pose buffer
        this.locomotionPose = this.BlendRagdoll(this.locomotionPose);
        Shadow.ReadShadowData(
            this.locomotionPose,
            transform.GetChild(0),
            this);
    }
Пример #3
0
 void Awake()
 {
     m_Animator    = GetComponent <Animator>();
     m_Rigidbody2D = GetComponent <Rigidbody2D>();
     m_Shadow      = GetComponentInChildren <ShadowController>();
     m_Sword       = GetComponentInChildren <SwordController>();
 }
Пример #4
0
    private ShadowTransform[] BlendController(
        ShadowController controller,
        ShadowTransform[] input,
        Slider weight,
        FilterList <string> filter = null)
    {
        if (weight.IsMin == true)
        {
            return(input);
        }

        // Update the target controller from that blend
        if (filter == null)
        {
            controller.Decode(input);
        }
        else
        {
            controller.Decode(input, filter);
        }
        controller.ControlledUpdate();
        ShadowTransform[] result
            = controller.Encode(this.NewTransformArray());

        return(BlendSystem.Blend(
                   this.NewTransformArray(),
                   new BlendPair(input, weight.Inverse),
                   new BlendPair(result, weight.Value)));
    }
Пример #5
0
        public override void ShowShadow()
        {
            if (instanceShadow == null && shadow != null)
            {
                instanceShadow = Instantiate(shadow) as GameObject;
                instanceShadow.transform.SetParent(transform.parent);
                instanceShadow.transform.localScale = new Vector3(1, 1, 1);
                instanceShadow.GetComponent <RectTransform>().anchorMax        = new Vector2(1, 1);
                instanceShadow.GetComponent <RectTransform>().anchorMin        = new Vector2(0, 0);
                instanceShadow.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, 0);
                instanceShadow.GetComponent <RectTransform>().sizeDelta        = new Vector2(0, 0);
                instanceShadow.GetComponent <RectTransform>().localRotation    = Quaternion.Euler(Vector3.zero);

                CanvasGroup canvasGroup = instanceShadow.AddComponent <CanvasGroup>();
                canvasGroup.alpha = 0f;

                ShadowController sc = instanceShadow.AddComponent <ShadowController>();
                sc.TargetCanvasGroup = GetComponent <CanvasGroup>();

                instanceShadow.transform.SetSiblingIndex(transform.GetSiblingIndex());
            }
            else if (shadow != null && instanceShadow != null)
            {
                instanceShadow.transform.SetSiblingIndex(transform.GetSiblingIndex() - 1);
                instanceShadow.SetActive(true);
            }
        }
Пример #6
0
        void Reset()
        {
            moveable             = GetComponent <MoveableUnit>();
            stopBeforeAttackable = GetComponent <StopBeforeAttackableUnit>();
            stopAfterAttackable  = GetComponent <StopAfterAttackableUnit>();
            dontStopAttackable   = GetComponent <DontStopAttackableUnit>();

            enemyTargetable    = GetComponent <EnemyTargetableUnit>();
            friendlyTargetable = GetComponent <FriendlyTargetableUnit>();
            randomMoveable     = GetComponent <RandomMoveableUnit>();
            rushMoveable       = GetComponent <RushMoveableUnit>();
            restRushMoveable   = GetComponent <RestRushMoveableUnit>();
            followMoveable     = GetComponent <FollowMoveableUnit>();
            boss0Moveable      = GetComponent <Boss0MoveableUnit>();

            damageable    = GetComponent <DamageableUnit>();
            hpable        = GetComponent <HpableUnit>();
            mpable        = GetComponent <MpableUnit>();
            deathable     = GetComponent <DeathableUnit>();
            effectable    = GetComponent <EffectableUnit>();
            timeLimitable = GetComponent <TimeLimitableUnit>();
            orderable     = GetComponent <Orderable>();
            followable    = GetComponent <FollowableUnit>();

            animator   = GetComponent <Animator>();
            rigid      = GetComponent <Rigidbody2D>();
            renderer   = GetComponent <SpriteRenderer>();
            collider   = GetComponent <Collider2D>();
            tackleable = GetComponent <TackleableUnit>();

            cachedTransform = transform;
            shadow          = GetComponentInChildren <ShadowController>();
        }
Пример #7
0
 public static void RefreshShadows()
 {
     if (ShadowController.IsPreviousRealTimeShadowEnable != GameLevelManager.IsRealTimeShadowOn())
     {
         XDict <long, EntityParent> allEntities = EntityWorld.Instance.AllEntities;
         using (List <EntityParent> .Enumerator enumerator = allEntities.Values.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 EntityParent current = enumerator.get_Current();
                 if (current != null & current.Actor)
                 {
                     if (ShadowController.IsPreviousRealTimeShadowEnable)
                     {
                         ShadowController.SetShadowModelRender(current.Actor.FixTransform, true);
                     }
                     else
                     {
                         ShadowProjector.ShowShadowProjector(current.Actor.FixTransform, true);
                     }
                     ShadowController.ShowShadow(current.ID, current.Actor.FixTransform, false, 0);
                 }
             }
         }
     }
     ShadowController.IsPreviousRealTimeShadowEnable = GameLevelManager.IsRealTimeShadowOn();
 }
Пример #8
0
    public void AddUnity(GameObject unityToAdd, int typeId)
    {
        GameManager.instance.SetUnit();
        UnityController u = unityToAdd.GetComponent <UnityController>();

        u.StablishUnit(unitScriptable.units[typeId].levelsDescription[DataController.instance.unitsData.units[typeId].level], unitScriptable.units[typeId].typeName);
        unities.Add(u);
        SearchInteractableObjects(u.transform.position, u.lightRange);

        RaycastHit hit;
        int        layerMask = 1 << 8;
        Ray        ray       = new Ray(new Vector3(unityToAdd.transform.position.x, unityToAdd.transform.position.y + 30, unityToAdd.transform.position.z), -unityToAdd.transform.up);

        /*Vector3 up = unityToAdd.transform.TransformDirection(Vector3.up) * 10;
         * Debug.DrawRay(unityToAdd.transform.position,up, Color.green,10);*/
        if (Physics.Raycast(ray, out hit, 30))
        {
            if (hit.transform.CompareTag("Shadow"))
            {
                unityToAdd.GetComponent <UnityController>().myTextCoord = hit.textureCoord;
                if (shadow == null)
                {
                    shadow = hit.transform.GetComponent <ShadowController>();
                    shadow.SetUnit(hit.textureCoord, unityToAdd.GetComponent <UnityController>().lightRange);
                }
                else
                {
                    shadow.SetUnit(hit.textureCoord, unityToAdd.GetComponent <UnityController>().lightRange);
                }
            }
        }
    }
Пример #9
0
 private void ActSelfChangeWeapon()
 {
     if (EntityWorld.Instance.ActSelf != null && this.CullingMasks.ContainsKey(RTManager.RtType.Player))
     {
         ShadowController.ShowShadow(EntityWorld.Instance.EntSelf.ID, EntityWorld.Instance.ActSelf, true, 0);
     }
 }
Пример #10
0
    private void ReferObjects()
    {
        //Fish Controller Refer
        FishController fishControl = gameObject.GetComponent <FishController>();

        fishControl.headHitBox         = hitBox;
        fishControl.fishIndicator      = ingamePlayerName.GetComponent <FishTextMesh>();
        fishControl.tFishHead          = fishHead.transform;
        fishControl.tFishBodies        = fishBodies.transform;
        fishControl.fishHead           = theHeadObject;
        fishControl.buffControl        = theHeadObject.GetComponent <BuffController> ();
        fishControl.fishIdleController = gameObject.GetComponent <IdleController> ();
        fishControl.fishLevelControl   = theHeadObject.GetComponent <FishLevelController> ();
        fishControl.fishEyeControl     = theFishEyes.GetComponent <FishEyeController> ();
        fishControl.fishHSVControl     = fishHead.GetComponent <FishHSVController> ();

        //Idle Controller Refer
        IdleController idleControl = gameObject.GetComponent <IdleController>();

        idleControl.fishAnimator  = theFish.GetComponent <Animator> ();
        idleControl.fishTransform = gameObject.transform;

        //Mesh Renderers Fish Refer
        MeshRenderersFish renderFish = fishHead.GetComponent <MeshRenderersFish>();

        renderFish.fishMeshRenderer = theFish.GetComponent <MeshRenderer> ();
        renderFish.fishText         = playerName.GetComponent <MeshRenderer> ();

        //Fish HSV Controller Refer
        FishHSVController fishHSVControl = fishHead.GetComponent <FishHSVController>();

        fishHSVControl.fish        = fishHead.GetComponent <MeshRenderersFish> ();
        fishHSVControl.fishEye     = theFishEyes.GetComponent <FishEyeController>();
        fishHSVControl.blinkEffect = shineEffect;

        //Shadow Controller Refer
        ShadowController shadowControl = fishShadow.GetComponent <ShadowController>();

        shadowControl.fishTransform = theFish.transform;

        //Buff Controller Refer
        BuffController buffControl = theHeadObject.GetComponent <BuffController>();

        buffControl.BuffAnimation       = buffParent.transform.GetChild(0).GetComponent <SkeletonAnimation> ();
        buffControl.fishRenderers       = fishHead.GetComponent <MeshRenderersFish> ();
        buffControl.buffParentTransform = buffParent.transform;
        buffControl.buffAnimationObject = buffParent.transform.GetChild(0).gameObject;
        buffControl.nosBuffGameObject   = buffParent.transform.GetChild(1).gameObject;

        //Fish Level Controller Refer - Fish Skin Name per level Previously included
        FishLevelController fishLevelControl = theHeadObject.GetComponent <FishLevelController>();

        fishLevelControl.fishControllerTransform = gameObject.transform;
        fishLevelControl.fish         = theFish.GetComponent <SkeletonAnimator> ();
        fishLevelControl.fishAnimator = theFish.GetComponent <Animator> ();
        fishLevelControl.fishRend     = fishHead.GetComponent <MeshRenderersFish> ();
        fishLevelControl.mouthAnim    = theFish.transform.GetChild(0).GetComponent <MouthAnimationController> ();
    }
Пример #11
0
    protected void SetPlayerActor(ActorPlayer actorPlayer, Action logicCallback)
    {
        AvatarModel avatarModel = DataReader <AvatarModel> .Get(this.FixModelID);

        base.Actor            = actorPlayer;
        actorPlayer.theEntity = this;
        base.Actor.FixGameObject.set_name(base.ID.ToString());
        base.Actor.FixGameObject.SetActive(true);
        base.Actor.InitActionPriorityTable();
        base.Actor.CanAnimatorApplyMotion = false;
        base.Actor.DataLayerState         = ((avatarModel.collideOff <= 0) ? 0 : 1);
        base.Actor.DefaultModelHeight     = avatarModel.defaultModelHeight;
        base.Actor.ModelHeight            = avatarModel.defaultModelHeight;
        base.Actor.IsLockModelDir         = (avatarModel.lockDirection == 1);
        base.Actor.RotateSpeed            = avatarModel.RotateSpeed;
        base.Actor.RotateInterval         = (float)avatarModel.rotateInterval;
        base.Actor.StartRotateAngle       = (float)avatarModel.startAngle;
        base.Actor.FinishRotateAngle      = (float)avatarModel.finishAngle;
        base.Actor.FloatRate = avatarModel.floatProba;
        ShadowController.ShowShadow(base.ID, base.Actor, false, this.FixModelID);
        ShaderEffectUtils.InitShaderRenderers(base.Actor.FixTransform, this.shaderRenderers, ref this.shadowRenderer, ref this.shadowSlicePlane);
        ShaderEffectUtils.InitHitEffects(this.shaderRenderers, this.hitControls);
        ShaderEffectUtils.InitTransparencys(this.shaderRenderers, this.alphaControls);
        ShaderEffectUtils.SetFadeRightNow(this.alphaControls, false);
        ShaderEffectUtils.SetOutlineStatus(base.Actor.FixTransform, LuminousOutline.Status.Normal);
        if (avatarModel.curve == 1)
        {
            ShaderEffectUtils.SetMeshRenderToLayerFXDistortion(base.Actor.FixTransform);
        }
        this.InitBillboard((float)avatarModel.height_HP, avatarModel.bloodBar);
        WaveBloodManager.Instance.AddWaveBloodControl(base.Actor.FixTransform, (float)avatarModel.height_Damage, base.ID);
        if (this.IsInBattle)
        {
            if (this.IsDead)
            {
                CommandCenter.ExecuteCommand(base.Actor.FixTransform, new PlayActionCmd
                {
                    actName    = "die",
                    jumpToPlay = true,
                    percent    = 1f
                });
            }
            else
            {
                base.Actor.CastAction("born", true, 1f, 0, 0, string.Empty);
            }
        }
        else
        {
            base.Actor.CastAction("idle", true, 1f, 0, 0, string.Empty);
        }
        if (logicCallback != null)
        {
            logicCallback.Invoke();
        }
        this.InitActorState();
    }
Пример #12
0
 void Start()
 {
     m_DuelController = GameObject.FindGameObjectWithTag("GameController")
                        .GetComponent <DuelController>();
     m_Player = GameObject.FindGameObjectWithTag("Player")
                .GetComponent <PlayerCharacter>();
     m_ShadowController = GetComponent <ShadowController>();
     m_DamageColor      = m_SpriteColor;
 }
Пример #13
0
        //public InteractionShadow(Transform node)
        //{
        //    renderQueue=3000;
        //    intension=0.25f;
        //    shaderName = "Legacy Shaders/Transparent/Diffuse";
        //    color=Color.yellow;
        //    Init(node);
        //}

        public void Init(Transform node)
        {
            shadowController?.Destroy();
            shadowController = null;
            //if (shadowController==null)
            //    shadowController=node.gameObject.GetComponent<ShadowController>();
            //if (shadowController==null)
            shadowController = node.gameObject.AddComponent <ShadowController>();
            shadowController.Init(node.parent, traModelNode, Color.yellow, intension, renderQueue, type, shaderName);
        }
Пример #14
0
 public static void ShowShadow(long uuid, ActorParent actorParent, bool bHideShadow, int modelId = 0)
 {
     if (actorParent is ActorMonster && (actorParent as ActorMonster).GetEntity().IsLogicBoss)
     {
         ShadowController.ShowShadow(uuid, actorParent.FixTransform, actorParent, bHideShadow, modelId);
     }
     else
     {
         ShadowController.ShowShadow(uuid, actorParent.FixTransform, null, bHideShadow, modelId);
     }
 }
Пример #15
0
 private static void SetShadow(int lod, bool init = false)
 {
     if (!init)
     {
         ShadowController.RefreshShadows();
     }
     else
     {
         ShadowController.IsPreviousRealTimeShadowEnable = GameLevelManager.IsRealTimeShadowOn();
     }
 }
 protected void SetModel(Transform root, int modelID)
 {
     base.GetAsyncModel(root, modelID, delegate
     {
         AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelID);
         if (avatarModel == null)
         {
             return;
         }
         BillboardManager.Instance.AddBillboardsInfo(23, root, (float)avatarModel.height_HP, (long)this.id, false, false, true);
         HeadInfoManager.Instance.SetName(23, (long)this.id, this.GetName());
         ShadowController.ShowShadow((long)this.id, root, false, modelID);
     });
 }
Пример #17
0
 public void CreateActor()
 {
     this.AsyncLoadID = EntityWorld.Instance.GetCityPetActorAsync(this.ModelID, delegate(ActorCityPet actorCityPet)
     {
         Pet dataPet         = DataReader <Pet> .Get(this.TypeID);
         this.Actor          = actorCityPet;
         actorCityPet.Entity = this;
         this.Actor.FixGameObject.set_name(this.ID.ToString());
         this.Actor.SetScale(PetManagerBase.GetCityPetModelZoom(dataPet, this.ModelID));
         ShadowController.ShowShadow(this.ID, this.Actor.FixTransform, false, this.ModelID);
         ActorVisibleManager.Instance.Add(this.ID, this.Actor.FixTransform, 22, this.OwnerID);
         this.Show();
     });
 }
Пример #18
0
    /// <summary>
    /// Makes a shadow, which is a hierarchy of GameObjects
    /// that matches the hierarchy given by root. It only
    /// contains the transform hierarchy and an animation
    /// component, nothing else!
    /// </summary>
    /// <param name="originalRoot">Root of the hierarchy to be shadowed</param>
    /// <param name="controller">The controller being assigned this shadow</param>
    /// <returns></returns>
    public Shadow(
        Transform originalRoot,
        Transform originalHips,
        ShadowController controller)
    {
        if (originalRoot.animation == null)
        {
            throw new System.ArgumentException(
                      "Component to be shadowed must have animation component",
                      "originalRoot");
        }

        this.controller = controller;
        this.quickFind  = new Dictionary <string, Transform>();

        // Incorporate both ignored bones and ignored non-bone transforms
        HashSet <string> ignores = new HashSet <string>(controller.ignoreBones);

        ignores.UnionWith(controller.Coordinator.NonBoneTransformsSet);

        this._rootObject = CloneHierarchy(originalRoot, ignores, quickFind);
        this._rootHips   = quickFind[originalHips.name];

        // Add the ShadowGizmo
        ShadowGizmo sg = this._rootObject.AddComponent <ShadowGizmo>();

        sg.parentController = controller;

        // Add animations in original GameObject to the shadow.
        // TODO: Allow shadow controllers to be more choosy about what
        //       animations get copied over, and make the animation
        //       component itself optional. - AS
        this._rootObject.AddComponent <Animation>();
        foreach (AnimationState aState in originalRoot.animation)
        {
            this._rootObject.animation.AddClip(aState.clip, aState.name);
        }
        this._rootObject.animation.playAutomatically = false;

        // The shadow should always animate, despite not being rendered
        // TODO: Adjust this as per LOD. - AS
        this._rootObject.animation.cullingType =
            AnimationCullingType.AlwaysAnimate;

        // Set the name based on what's being cloned
        string name = controller.GetType().ToString();

        this._rootObject.name += " (Shadow: " + name + ")";
    }
Пример #19
0
    public void ZoomOut()
    {
        _mainCamera.gameObject.GetComponent <Camera2DTweener>().TweenTo(new Vector3(6f, -2f, -2.3f), 31f, 0.5f, this.gameObject);

        // Room shadow tweening
        GameObject shadow = GameObject.Find("Sombras/Sombra_" + _room) as GameObject;

        if (shadow)
        {
            ShadowController sc = shadow.GetComponent <ShadowController>();
            sc.ShadowOut();
        }

        _zoomed = ZoomState.Zooming;
    }
Пример #20
0
    public void RegisterController(ShadowController controller)
    {
        if (this.shadowControllers == null)
            this.shadowControllers = new Dictionary<string, ShadowController>();

        if (this.boneKeys == null)
            this.InitBoneKeys();

        string name = controller.GetType().ToString();
        this.shadowControllers[name] = controller;
        controller.shadow = new Shadow(this.transform, controller);

        // The controller is now ready to wake up
        controller.ControlledAwake();
    }
Пример #21
0
    void Start()
    {
        shadowController = GetComponentInChildren <ShadowController> ();
        shadowBox        = dropShadow.GetComponent <BoxCollider2D> ();
        boxCollider      = GetComponent <BoxCollider2D> ();
        boxRB            = GetComponent <Rigidbody2D> ();
//		CalculateShadowTrajectory ();
        shadowController.SetVelocity(Vector3.forward * boxRB.velocity.y);
        shadowController.Drop();


        strikeTime   = Time.time + airTime;
        midPointTime = strikeTime - (airTime * 0.5f);
        grounded     = false;
    }
Пример #22
0
 public override void CreateActor()
 {
     base.AsyncLoadID = EntityWorld.Instance.GetCityMonsterActorAsync(this.ModelID, delegate(ActorWildMonster actorMonster)
     {
         Monster monster = DataReader <Monster> .Get(this.TypeID);
         base.Actor      = actorMonster;
         base.Actor.InitActionPriorityTable();
         actorMonster.theEntity  = this;
         AvatarModel avatarModel = DataReader <AvatarModel> .Get(this.ModelID);
         BillboardManager.Instance.AddBillboardsInfo(25, base.Actor.FixTransform, (float)avatarModel.height_HP, base.ID, false, true, true);
         ShadowController.ShowShadow(base.ID, base.Actor.FixTransform, false, this.modelID);
         LayerSystem.SetGameObjectLayer(base.Actor.FixGameObject, "CityPlayer", 2);
         ActorVisibleManager.Instance.Add(base.ID, base.Actor.FixTransform, 25, 0L);
         base.Actor.SetAllCollider(true);
         this.Show();
     });
 }
	void Awake() {
		efxSource = GetComponent<AudioSource> ();
		dropShadow = Instantiate<GameObject> (dropShadowPrefab, transform.position, Quaternion.identity);
		dropShadow.SetActive (false);
		shadowController = GetComponentInChildren<ShadowController> ();
		spriteRenderer = GetComponent<SpriteRenderer> ();
		rb2D = GetComponent<Rigidbody2D> ();
		landingParticles = GetComponentInChildren<ParticleSystem> ();		// the landing particle system must be the first child of the throwable gameobject for this to work

		if (Throwable.throwSectors == null) {
			Throwable.throwSectors = new List<Range> ();
			float throwSectorAngle = 359.9375f / throwSectorCount;
			for (int i = 0; i < throwSectorCount; i++) {
				float currentMinAngle = i * throwSectorAngle;
				Throwable.throwSectors.Add (new Range (currentMinAngle, currentMinAngle + throwSectorAngle));
			}
		}
	}
Пример #24
0
    void Update()
    {
        if (this.buffer == null)
            this.buffer = this.NewTransformArray();

        if (this.controller == null)
            foreach (ShadowController sc in this.shadowControllers.Values)
                this.controller = sc;

        UpdateCoordinates();
        this.controller.ControlledUpdate();
        this.controller.Encode(this.buffer);

        Shadow.ReadShadowData(
            this.buffer,
            transform.GetChild(0),
            this);
    }
Пример #25
0
        public EventRecurrence(Appointment appointment)
        {
            InitializeComponent();
            _appointment = appointment;

            // Initialize display to defaults
            InitializeNewDisplay();

            if (_appointment.IsRepeating)
            {
                InitializeRepeatDisplay();
            }

            Loaded += EventRecurrence_Loaded;

            AccessKeyManager.Register(" ", okButton);

            ShadowController c = new ShadowController(this);
        }
Пример #26
0
    private void Start()
    {
        // get the transform of the main camera
        if (Camera.main != null)
        {
            m_Cam = Camera.main.transform;
        }
        else
        {
            Debug.LogWarning(
                "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.", gameObject);
            // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
        }

        // get the third person character ( this should never be null due to require component )
        m_Character        = GetComponent <Character>();
        m_ShadowController = GetComponent <ShadowController>();
        m_Animator         = GetComponent <Animator>();
    }
Пример #27
0
 private void DoEquipWeapons(int equipId, EquipBody dataEB, Action <bool> finished)
 {
     this.InstantiateEquipWeapon(equipId, dataEB, delegate(GameObject weapon1, GameObject weapon2)
     {
         if (this.ActorTarget == null)
         {
             this.ClearWeaponTemp(weapon1, weapon2);
             finished.Invoke(false);
             return;
         }
         if (!this.VerifyWeapon(equipId))
         {
             this.ClearWeaponTemp(weapon1, weapon2);
             finished.Invoke(false);
             return;
         }
         if (weapon1 == null)
         {
             this.ClearWeaponTemp(weapon1, weapon2);
             finished.Invoke(false);
             return;
         }
         this.ClearWeapons();
         if (weapon1 != null)
         {
             EquipCustomizationTool.SetLayer(weapon1, this.ActorTarget);
             ShadowController.SetShadowModelRender2Child(this.ActorTarget.get_transform(), weapon1.get_transform(), false);
             this.m_goWeapons.Add(weapon1);
             this.SetWeapon2Slot(this.GetWeaponSlotRealName(dataEB.slot), true);
         }
         if (weapon2 != null)
         {
             EquipCustomizationTool.SetLayer(weapon2, this.ActorTarget);
             ShadowController.SetShadowModelRender2Child(this.ActorTarget.get_transform(), weapon2.get_transform(), false);
             this.m_goWeapons.Add(weapon2);
             this.SetWeapon2Slot(this.GetWeaponSlotRealName(dataEB.slot), true);
         }
         if (finished != null)
         {
             finished.Invoke(weapon1 != null);
         }
     });
 }
Пример #28
0
    /// <summary>
    /// Makes a shadow, which is a hierarchy of GameObjects
    /// that matches the hierarchy given by root. It only
    /// contains the transform hierarchy and an animation 
    /// component, nothing else! 
    /// </summary>
    /// <param name="originalRoot">Root of the hierarchy to be shadowed</param>
    /// <param name="controller">The controller being assigned this shadow</param>
    /// <returns></returns>
    public Shadow(
        Transform originalRoot, 
        Transform originalHips,
        ShadowController controller)
    {
        if (originalRoot.GetComponent<Animation>() == null)
            throw new System.ArgumentException(
                "Component to be shadowed must have animation component",
                "originalRoot");

        this.controller = controller;
        this.quickFind = new Dictionary<string, Transform>();

        // Incorporate both ignored bones and ignored non-bone transforms
        HashSet<string> ignores = new HashSet<string>(controller.ignoreBones);
        ignores.UnionWith(controller.Coordinator.NonBoneTransformsSet);

        this._rootObject = CloneHierarchy(originalRoot, ignores, quickFind);
        this._rootHips = quickFind[originalHips.name];

        // Add the ShadowGizmo
        ShadowGizmo sg = this._rootObject.AddComponent<ShadowGizmo>();
        sg.parentController = controller;

        // Add animations in original GameObject to the shadow.
        // TODO: Allow shadow controllers to be more choosy about what
        //       animations get copied over, and make the animation
        //       component itself optional. - AS
        this._rootObject.AddComponent<Animation>();
        foreach (AnimationState aState in originalRoot.GetComponent<Animation>())
            this._rootObject.GetComponent<Animation>().AddClip(aState.clip, aState.name);
        this._rootObject.GetComponent<Animation>().playAutomatically = false;

        // The shadow should always animate, despite not being rendered
        // TODO: Adjust this as per LOD. - AS
        this._rootObject.GetComponent<Animation>().cullingType =
            AnimationCullingType.AlwaysAnimate;

        // Set the name based on what's being cloned
        string name = controller.GetType().ToString();
        this._rootObject.name += " (Shadow: " + name + ")";
    }
Пример #29
0
    public void RegisterController(ShadowController controller)
    {
        if (this.shadowControllers == null)
        {
            this.shadowControllers = new Dictionary <string, ShadowController>();
        }

        if (this.boneKeys == null)
        {
            this.InitBoneKeys();
        }

        string name = controller.GetType().ToString();

        this.shadowControllers[name] = controller;
        controller.shadow            = new Shadow(this.transform, this.hips, controller);

        // The controller is now ready to wake up
        controller.ControlledAwake();
    }
 protected void SetModel(Transform root, int modelID)
 {
     base.GetAsyncModel(root, modelID, delegate
     {
         CaiJiPeiZhi caiJiPeiZhi = DataReader <CaiJiPeiZhi> .Get(this.collectionDataID);
         AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelID);
         this.animator           = root.GetComponentInChildren <Animator>();
         if (this.animator)
         {
             AssetManager.AssetOfControllerManager.SetController(this.animator, modelID, false);
             this.ChangeAnimationSpeed();
         }
         this.SetCharacterController(root);
         BillboardManager.Instance.AddBillboardsInfo(31, root, (float)avatarModel.height_HP, (long)this.id, false, true, true);
         if (caiJiPeiZhi.name != 0)
         {
             HeadInfoManager.Instance.SetName(31, (long)this.id, GameDataUtils.GetChineseContent(caiJiPeiZhi.name, false));
         }
         ShadowController.ShowShadow((long)this.id, root, false, modelID);
     });
 }
Пример #31
0
    private static void ShowShadow(long uuid, Transform actorTarget, ActorParent actorParent, bool bHideShadow, int modelId = 0)
    {
        if (GameLevelManager.IsRealTimeShadowOn())
        {
            ShadowController.SetShadowModelRender(actorTarget, bHideShadow);
        }
        else
        {
            float scale = 1f;
            if (modelId > 0)
            {
                AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelId);

                if (avatarModel != null)
                {
                    scale = avatarModel.projectorScale;
                }
            }
            ShadowSlicePlaneMgr.ShowShadowSlicePlane(uuid, actorTarget, actorParent, bHideShadow, scale);
        }
    }
Пример #32
0
 protected void SetModel(Transform root, int modelID)
 {
     base.GetAsyncModel(root, modelID, delegate
     {
         NPC nPC = DataReader <NPC> .Get(this.npcDataID);
         AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelID);
         this.animator           = root.GetComponentInChildren <Animator>();
         if (this.animator)
         {
             AssetManager.AssetOfControllerManager.SetController(this.animator, modelID, false);
             this.CastAction(this.DefaultIdleActionStatus);
             this.ChangeAnimationSpeed();
         }
         this.SetCharacterController(root);
         BillboardManager.Instance.AddBillboardsInfo(31, root, (float)avatarModel.height_HP, (long)this.id, false, true, true);
         HeadInfoManager.Instance.SetName(31, (long)this.id, GameDataUtils.GetChineseContent(nPC.name, false));
         ShadowController.ShowShadow((long)this.id, root, false, modelID);
         ActorVisibleManager.Instance.Add((long)this.id, root, 31, 0L);
         this.ShowShopInfo(nPC, root, avatarModel.height_HP);
     });
 }
Пример #33
0
 protected void SetModel(Transform root, int modelID)
 {
     base.GetAsyncModel(root, modelID, delegate
     {
         Monster monster         = DataReader <Monster> .Get(this.monsterDataID);
         AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelID);
         CharacterController[] componentsInChildren = root.GetComponentsInChildren <CharacterController>();
         if (componentsInChildren != null && componentsInChildren.Length > 0)
         {
             for (int i = 0; i < componentsInChildren.Length; i++)
             {
                 componentsInChildren[i].set_enabled(avatarModel.collideOff == 0);
             }
         }
         this.animator = root.GetComponentInChildren <Animator>();
         BillboardManager.Instance.AddBillboardsInfo(25, root, (float)avatarModel.height_HP, (long)this.id, false, true, true);
         HeadInfoManager.Instance.SetName(25, (long)this.id, GameDataUtils.GetChineseContent(monster.name, false));
         ShadowController.ShowShadow((long)this.id, root, false, modelID);
         ActorVisibleManager.Instance.Add((long)this.id, root, 25, 0L);
     });
 }
Пример #34
0
 protected void SetModel(Transform root, int modelID)
 {
     base.GetAsyncModel(root, modelID, delegate
     {
         Monster monster         = DataReader <Monster> .Get(this.monsterDataID);
         AvatarModel avatarModel = DataReader <AvatarModel> .Get(modelID);
         CharacterController[] componentsInChildren = root.GetComponentsInChildren <CharacterController>();
         if (componentsInChildren != null && componentsInChildren.Length > 0)
         {
             for (int i = 0; i < componentsInChildren.Length; i++)
             {
                 componentsInChildren[i].set_enabled(avatarModel.collideOff == 0);
             }
         }
         this.animator = root.GetComponentInChildren <Animator>();
         BillboardManager.Instance.AddBillboardsInfo(23, root, (float)avatarModel.height_HP, (long)this.id, false, true, true);
         HeadInfoManager.Instance.SetName(23, (long)this.id, TextColorMgr.GetColorByID(string.Format(GameDataUtils.GetChineseContent((!this.isMultiBoss) ? 505163 : 505164, false), this.monsterLv, GameDataUtils.GetChineseContent(monster.name, false), (!this.isMultiBoss) ? DataReader <YeWaiBOSSJieJi> .Get(this.monsterLv).SingleRank : DataReader <YeWaiBOSSJieJi> .Get(this.monsterLv).ManyRank), (!this.isMultiBoss) ? 1000007 : 1000009));
         ShadowController.ShowShadow((long)this.id, root, false, modelID);
         ActorVisibleManager.Instance.Add((long)this.id, root, 23, 0L);
         this.AppState();
     });
 }
Пример #35
0
 // Use this for initialization
 void Start()
 {
     this.coordinator = rootObject.GetComponent<ShadowCoordinator>();
     this.controller = coordinator.GetController(shadowName);
 }
Пример #36
0
 void Start()
 {
     this.dummyController = this.shadowControllers["ShadowDummyController"];
     this.reachController = this.shadowControllers["ShadowReachController"];
 }
 void Start()
 {
     this.dummyController = this.shadowControllers["ShadowDummyController"];
     this.headlookController = this.shadowControllers["ShadowHeadLookController"];
 }
Пример #38
0
    private ShadowTransform[] BlendController(
        ShadowController controller,
        ShadowTransform[] input,
        Slider weight,
        FilterList<string> filter = null)
    {
        if (weight.IsMin == true)
            return input;

        // Update the target controller from that blend
        if (filter == null)
            controller.Decode(input);
        else
            controller.Decode(input, filter);
        controller.ControlledUpdate();
        ShadowTransform[] result
            = controller.Encode(this.NewTransformArray());

        return BlendSystem.Blend(
            this.NewTransformArray(),
            new BlendPair(input, weight.Inverse),
            new BlendPair(result, weight.Value));
    }
Пример #39
0
 public void SetShadowController(ShadowController controller)
 {
     shadowContoller = controller;
 }
Пример #40
0
 // Used for inheritance
 protected Shadow()
 {
     this._rootObject = null;
     this.controller = null;
 }