Esempio n. 1
0
        public void SerializeTest()
        {
            IActor       actor        = new BaseActor();
            const string someData     = "TestData";
            SerialObject serialObject = new SerialObject(someData, actor.Tag);

            Assert.AreEqual("TestData", serialObject.Data);
            Assert.AreEqual(actor.Tag, serialObject.Tag);

            NetDataContractSerializeService service = new NetDataContractSerializeService();

            using (MemoryStream serializeStream = new MemoryStream())
            {
                service.Serialize(serialObject.Data, serialObject.Tag, serializeStream);
                serializeStream.Seek(0, SeekOrigin.Begin); // rewind

                using (MemoryStream deserializeStream = new MemoryStream())
                {
                    serializeStream.CopyTo(deserializeStream);
                    SerialObject returnObject = service.Deserialize(deserializeStream) as SerialObject;
                    Assert.IsNotNull(returnObject);
                    Assert.IsNotNull(returnObject.Data);
                    Assert.IsNotNull(returnObject.Tag);
                    Assert.AreEqual("TestData", returnObject.Data);
                    Assert.AreEqual(actor.Tag, returnObject.Tag);
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var actor1 = new BaseActor(new Behavior <string>(s => Console.WriteLine(s)));

            actor1.SendMessage("Hello World !");
            Console.ReadLine();
        }
Esempio n. 3
0
        /// <summary>
        /// The block all collisions.
        /// </summary>
        /// <param name="a">
        /// The <see cref="BaseActor"/> colliding with an object.
        /// </param>
        /// <param name="loadedactors">
        /// The <see cref="BaseActor"/> that is being collided with.
        /// </param>
        public static void BlockAllCollisions(BaseActor a, List <BaseActor> loadedactors)
        {
            var collisions = GetAllCollisions(loadedactors, a);

            foreach (var c in collisions.Where(c => c.CollisionAction == BaseActor.CollisionType.Block))
            {
                if (IsActorStandingOnAnother(a, c))
                {
                    // Standing
                    a.Position = new Vector2D_Dbl(a.Position.X, c.Position.Y - a.Height);
                    a.Velocity = new Vector2D_Dbl(a.Velocity.X, a.Velocity.Y < 0 ? 0 : a.Velocity.Y);
                }
                else if (IsActorPushingAnotherFromLeft(a, c))
                {
                    // OnLeftSide
                    a.Position = new Vector2D_Dbl(c.Position.X - a.Width, a.Position.Y);
                    a.Velocity = new Vector2D_Dbl(0, a.Velocity.Y);
                }
                else if (IsActorPushingAnotherFromRight(a, c))
                {
                    // OnRightSide
                    a.Position = new Vector2D_Dbl(c.Position.X + c.Width, a.Position.Y);
                    a.Velocity = new Vector2D_Dbl(0, a.Velocity.Y);
                }
                else if (IsActorPushingAnotherFromBottom(a, c))
                {
                    // OnBottom
                    a.Position = new Vector2D_Dbl(a.Position.X, c.Position.Y + c.Height);
                    a.Velocity = new Vector2D_Dbl(a.Velocity.X, 0);
                }
            }
        }
Esempio n. 4
0
 public void Cancel()
 {
     TargetBaseActor = null;
     TargetingEnemy  = false;
     TargetedObject.SetActive(false);
     TargetObjectName.GetComponent <Text>().text = string.Empty;
 }
Esempio n. 5
0
        public override void Transform(BaseActor actor, Vector3?pos, Quaternion?rot, Vector3?scale)
        {
            TransformComponent transform = actor.GetComponent <TransformComponent>();

            if (transform != null)
            {
                if (pos != null)
                {
                    transform.Position = pos.Value;
                }
                if (rot != null)
                {
                    transform.Rotation = rot.Value;
                }
                if (scale != null)
                {
                    transform.Scale = scale.Value;
                }
            }

            RenderComponent renderComponent = transform.Sibling <RenderComponent>();//actor.GetComponent<RenderComponent>();
            //if(renderComponent != null)
            {
                SyncRenderComponent(renderComponent, transform);
            }
            //TODO:
            //UnityActor unityActor = (UnityActor)actor;
            //unityActor.SyncUnityPos();
        }
Esempio n. 6
0
        /// <summary>
        /// AnimationState should == animationKey! then we can eliminate the need for manual input of string.
        /// </summary>
        public void SetAnimatorController(ActorData data)
        {
            actor          = GetComponent <BaseActor>();
            spriteRenderer = GetComponent <SpriteRenderer>();


            if (data.colorPalette.Length > 0 && GetComponent <PaletteSwap>() != null && data.baseActor != null)
            {
                PaletteSwap pSwap = GetComponent <PaletteSwap>();
                pSwap.enabled = true;
                pSwap.swapOutPaletteDefault = data.baseActor.colorPalette;
                pSwap.swapInPaletteDefault  = data.colorPalette;
            }


            spriteRenderer.material = new Material(Shader.Find("AtomosZ/NoSwapShader"));
            spriteMaterial          = spriteRenderer.material;
            offsetPropertyId        = Shader.PropertyToID("_Offset");

            animator = GetComponent <Animator>();
            spriteRenderer.sprite = data.sprite;
            if (data.animatorController == null)
            {
                Debug.LogWarning(data.actorName + " data has no animatorController");
            }
            else
            {
                animator.runtimeAnimatorController = data.animatorController;
                animationPrefix = data.animationPrefix;
                if (!animationPrefix.EndsWith("_"))
                {
                    animationPrefix += "_";
                }
            }
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DateTimeOffset start   = DateTimeOffset.UtcNow;
            int            rcvmess = 0;

            int.TryParse(tbQtt.Text, out int qttMess);
            if (qttMess > 0)
            {
                catcher.SetEvent(lblDuration, new EventHandler <string>(this.EvHandler));
                var actor = new BaseActor(new Behavior <string>(t => { return(true); }, t =>
                {
                    rcvmess++; if (rcvmess >= qttMess)
                    {
                        DateTimeOffset end = DateTimeOffset.UtcNow;
                        catcher.SendMessage(string.Format("start {0} end {1} Duration{2}",
                                                          start.ToString(), end.ToString(), end.Subtract(start).ToString()));
                    }
                }
                                                                ));
                for (int i = 0; i < qttMess; i++)
                {
                    actor.SendMessage("go");
                }
            }
        }
Esempio n. 8
0
    /// <summary>
    /// 创建普通NPC
    /// </summary>
    /// <param name="type">角色类型</param>
    /// <param name="id">角色ID</param>
    /// <param name="name">角色资源名字</param>
    /// <param name="scale">缩放大小</param>
    /// <returns></returns>
    ///
    //public BaseActor CreateActor<T>(CustomerConfigData configData, float scale = 1) where T:BaseActor
    //{
    //if (!actorPool.ContainsKey(configData.icon))
    //    actorPool.Add(configData.icon, new List<GameObject>());

    //GameObject actorObject = ResourceManager.Instance.GetResourceInstantiate(configData.icon, Instance.transform.transform, ResouceType.Actor);
    //actorPool[configData.icon].Add(actorObject);
    //BaseActor base_class = actorObject.GetOrAddComponent<T>();

    //return base_class;
    //return null;
    //}
    /// <summary>
    /// 销毁角色
    /// </summary>
    /// <param name="go"></param>
    /// <returns></returns>
    public bool DestroyActor(GameObject go)
    {
        if (go == null)
        {
            return(false);
        }

        BaseActor actor = go.GetComponent <BaseActor>();

        if (actor != null)
        {
            actor.Release();
            //DestroyImmediate(actor);
        }

        string key = go.name.Replace("(Clone)", "");

        if (!actorPool.ContainsKey(key))
        {
            //Destroy(go);
            return(false);
        }
        if (actorPool[key].Count > POOL_LIMITED)
        {
            actorPool[key].Remove(go);
            //Destroy(go);
            return(true);
        }
        return(true);
    }
Esempio n. 9
0
        public void BehaviorAndInterfaceTest()
        {
            IBehavior bhv = new Behavior <BaseActor>(
                a => { });

            IActor iBaseActor = new BaseActor();

            Assert.IsTrue(bhv.StandardPattern(iBaseActor));

            BaseActor baseActor = new BaseActor();

            Assert.IsTrue(bhv.StandardPattern(baseActor));

            ActionActor actionActor = new ActionActor();

            Assert.IsTrue(bhv.StandardPattern(actionActor));

            IFuture future = new Future <string>();

            Assert.IsTrue(bhv.StandardPattern(future));

            IBehavior <IActor, IActor> bhv2 = new Behavior <IActor, IActor>((a1, a2) => { });

            Assert.IsTrue(bhv2.StandardPattern(new MessageParam <IActor, IActor>(new BaseActor(), new Future <string>())));
        }
Esempio n. 10
0
    // Update is called once per frame
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Rigidbody2D targetRigidBody = collision.collider.gameObject.GetComponent <Rigidbody2D>();
        BaseActor   targetBaseActor = collision.collider.gameObject.GetComponent <BaseActor>();

        float bounceStrenght = 5f;
        float bounceForce;

        Debug.Log(bounceStrenght);
        if (targetRigidBody.position.y <= this.gameObject.transform.position.y)
        {
            bounceForce = bounceStrenght * -1f;
        }
        else
        {
            bounceForce = bounceStrenght;
        }

        if (targetRigidBody != null)
        {
            if (targetBaseActor == null)
            {
                targetRigidBody.velocity = new Vector2(targetRigidBody.velocity.x, bounceForce);
            }
            else
            {
                if (targetBaseActor.jumpPressed)
                {
                }
                targetRigidBody.velocity = new Vector2(targetBaseActor.lastVelocity.x, bounceForce);
            }
        }
    }
Esempio n. 11
0
        private BaseActor CreateActor(ActorName actorName)
        {
            BaseActor actor = null;

            switch (actorName.Type)
            {
            case ActorTypeEnum.AdtPatientRegistration:
                actor = new AdtPatientRegistrationActor(actorName.Id, this);
                break;

            case ActorTypeEnum.OrderPlacer:
                actor = new OrderPlacerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.DssOrderFiller:
                actor = new DssOrderFillerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.AcquisitionModality:
                actor = new AcquisitionModalityActor(actorName.Id, this);
                break;

            case ActorTypeEnum.ImageManager:
                actor = new ImageManagerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.ImageArchive:
                actor = new ImageArchiveActor(actorName.Id, this);
                break;

            case ActorTypeEnum.PerformedProcedureStepManager:
                actor = new PpsManagerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.EvidenceCreator:
                actor = new EvidenceCreatorActor(actorName.Id, this);
                break;

            case ActorTypeEnum.ImageDisplay:
                actor = new ImageDisplayActor(actorName.Id, this);
                break;

//				case ActorTypeEnum.ReportManager:
//					actor = new ReportManagerActor(actorName.Id, this);
//					break;
            case ActorTypeEnum.PrintComposer:
                actor = new PrintComposerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.PrintServer:
                actor = new PrintServerActor(actorName.Id, this);
                break;

            case ActorTypeEnum.Unknown:
            default:
                break;
            }

            return(actor);
        }
Esempio n. 12
0
        public void FSMBehaviorsTest()
        {
            TestLauncherActor.Test(() =>
            {
                var behaviors = new FsmBehaviors <string, int>();
                behaviors
                .AddRule("StartState", i => i == 1, i => { }, "MidState")
                .AddRule("MidState", i => i == 2, i => { }, "EndState");

                var fsmActor = new BaseActor(behaviors);

                var currentState1 = new Future <string>();
                fsmActor.SendMessage(currentState1);
                Assert.IsTrue(currentState1.Result() == "StartState");

                fsmActor.SendMessage(1);

                var currentState2 = new Future <string>();
                fsmActor.SendMessage(currentState2);
                Assert.IsTrue(currentState2.Result() == "MidState");

                fsmActor.SendMessage(2);

                var currentState3 = new Future <string>();
                fsmActor.SendMessage(currentState3);
                Assert.IsTrue(currentState3.Result() == "EndState");

                fsmActor.SendMessage(3);

                // unchanged shoud be
                var currentState4 = new Future <string>();
                fsmActor.SendMessage(currentState4);
                Assert.IsTrue(currentState4.Result() == "EndState");
            });
        }
 private void DeleteActor(BaseActor actor)
 {
     if (actor != null)
     {
         DeleteActor(treeViewHierarchy.Nodes.Find(actor.Id, true).FirstOrDefault());
     }
 }
Esempio n. 14
0
    public void Shoot(BaseActor baseActor, Vector3 firPos, Vector3 hitPos, bool sendMsg)
    {
        //if (baseActor.fireDrawLine.drawLineGun.isHit)//射线
        //{
        //    baseActor.fireDrawLine.drawLineGun.lineRenderer.enabled = true;
        //    baseActor.fireDrawLine.drawLineGun.beginTime = Time.time;            
        //}
        
        baseActor.fireDrawLine.drawLineGun.Draw(baseActor.info.m_GunList[baseActor.info.useGunIndex].info.obj.GetComponent<GunScript>().firePoint.transform.position, hitPos);       

        baseActor.info.obj.GetComponent<AnimationControl>().Fire();//动作
        flash.OnFlash();//闪光
        //实例化子弹
        GameObject go = Global.Instance.srcManager.SynLoadSrc(SrcManager.ESrcType.Gun, "Src/Prefab/Gun/Bullet", typeof(GameObject)) as GameObject;
        //子弹初始化
        go.GetComponent<Bullet>().Init(baseActor.info.m_GunList[baseActor.info.useGunIndex].info.speed,
            baseActor.info.m_GunList[baseActor.info.useGunIndex].info.bullet_quality,
            baseActor.info.m_GunList[baseActor.info.useGunIndex].info.caliber,
            baseActor.info.m_GunList[baseActor.info.useGunIndex].info.range);
        go.transform.localPosition = firPos;
        go.transform.LookAt(hitPos);
        go.GetComponent<Bullet>().sendMsg = sendMsg;
        go.GetComponent<Bullet>().fireActor = baseActor;

        LoadFireAudio(baseActor, go);//声音
    }
Esempio n. 15
0
    protected void OnCollisionEnter(Collision collision)
    {
        if (m_thrower == null)
        {
            return;
        }

        if (collision.collider == LevelGenerator.Instance.m_groundCollider)
        {
            m_thrower = null;
            return;
        }


        BaseBuildingPart part = collision.collider.GetComponentInParent <BaseBuildingPart>();

        if (part != null)
        {
            part.TakeDamage(3, -collision.contacts[0].normal);
        }
        else
        {
            BaseActor actor = collision.collider.GetComponentInParent <BaseActor>();
            if (actor != null && m_thrower != actor)
            {
                actor.TakeDamage(2, -collision.contacts[0].normal);
            }
        }
    }
Esempio n. 16
0
        public void Display(Dialog dialog, DialogPartner initiator, DialogPartner initiated, int startingPage = 0)
        {
            if (animatingOpenClose)
            {
                return;
            }

            forceFacing = false;

            BaseActor actor = null;

            if (initiator != null)
            {
                actor = initiator.GetComponent <BaseActor>();
                if (actor != null)
                {
                    actor.Move(Vector2.zero);
                }
            }
            if (initiated != null)
            {
                actor = initiated.GetComponent <BaseActor>();
                if (actor != null)
                {
                    actor.Move(Vector2.zero);
                }
            }

            this.dialog = dialog;
            SetVisibility(true);
            this.initiated = initiated;
            this.initiator = initiator;
            DisplayPage(startingPage);
        }
Esempio n. 17
0
        public void BehaviorsFunctionalTest()
        {
            IActor     actor     = new BaseActor();
            IBehaviors behaviors = new Behaviors();

            behaviors.LinkToActor(actor);
            Assert.AreEqual(actor, behaviors.LinkedActor);

            behaviors
            .AddBehavior(new Behavior <string>())
            .AddBehavior(new Behavior <int>());

            Assert.AreEqual(2, behaviors.AllBehaviors().Count());
            Assert.IsTrue(behaviors.AllBehaviors().Any(b => b is IBehavior <string>));
            Assert.IsTrue(behaviors.AllBehaviors().Any(b => b is IBehavior <int>));

            foreach (var bhv in behaviors.AllBehaviors())
            {
                Assert.IsTrue(bhv.LinkedTo == behaviors);
            }

            IBehavior bhvString = behaviors.AllBehaviors().First(b => b is IBehavior <string>);

            behaviors.RemoveBehavior(bhvString);
            Assert.IsFalse(behaviors.FindBehavior(bhvString));
            Assert.IsTrue(behaviors.AllBehaviors().Count() == 1);
            Assert.IsFalse(bhvString.LinkedTo == behaviors);

            Assert.IsTrue(bhvString.LinkedActor == null);
        }
Esempio n. 18
0
 public void RemoveActor(BaseActor oldActor)
 {
     if (m_teleportActorList.Find(actor => actor == oldActor))
     {
         m_teleportActorList.Remove(oldActor);
     }
 }
Esempio n. 19
0
 public LightingBullet(ILevelInfo info, BaseActor owner) : base(info, owner)
 {
     Speed     = 20;
     Width     = 30;
     Height    = 30;
     ActorType = ActorType.LightWeapon;
 }
Esempio n. 20
0
 /// <summary>
 /// Method for defining what happens when a given list of actors collide with another actor.
 /// </summary>
 /// <param name="allactors">List of <c>BaseActor</c> that will be colliding with</param>
 /// <param name="collidedwith"><c>BaseActor</c> object being collided with.</param>
 /// <returns>List of <c>BaseActor</c> and their collision states</returns>
 public static List <BaseActor> GetAllCollisions(List <BaseActor> allactors, BaseActor collidedwith)
 {
     return(allactors
            .Where(x => x != collidedwith)
            .Where(x => CollidedWith(x, collidedwith))
            .ToList());
 }
Esempio n. 21
0
        public void TestMessageTracer()
        {
            IMessageTracerService mts = new MemoryMessageTracerService();

            TestLauncherActor.Test(() =>
            {
                BaseActor actor1 = new BaseActor()
                {
                    MessageTracerService = mts
                };
                actor1.SendMessage("Test 1");
                actor1.SendMessage("Test 2");
                actor1.SendMessage("Test 3");
            });

            var    query = mts.CopyAllMessages().ToList();
            string s     = string.Empty;

            query.ForEach(item => s += item);
            Assert.AreEqual(3, query.Count, s);
            Assert.IsTrue(query.Contains("Test 2"));
            Assert.IsFalse(query.Contains("Test 4"));
            Assert.AreEqual("Test 1", query.First());
            Assert.AreEqual("Test 3", query.Last());
        }
Esempio n. 22
0
    //public void AddActor(BaseActor baseActor)
    //{
    //    m_ActorList.Add(baseActor);
    //}

    public void AddActorObj(BaseActor baseActor)
    {
        switch (baseActor.info.type)
        {
            case BaseActor.Type.Female:
                {
                    baseActor.info.obj = Global.Instance.srcManager.SynLoadSrc(SrcManager.ESrcType.Model, "Src/Prefab/Actor/Actor_Dohee", typeof(GameObject)) as GameObject;
                    //baseActor.info.obj.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 20.0f, 0.0f));
                }
                break;
            case BaseActor.Type.Male:
                {
                    baseActor.info.obj = Global.Instance.srcManager.SynLoadSrc(SrcManager.ESrcType.Model, "Src/Prefab/Actor/Actor_Raymond", typeof(GameObject)) as GameObject;
                    //baseActor.info.obj.transform.localRotation = Quaternion.Euler(new Vector3(0.0f, 20.0f, 0.0f));
                }
                break;
            default:
                break;                
        }
        AnimationControl aniControl = baseActor.info.obj.AddComponent<AnimationControl>();
        baseActor.info.tranHead = ActorManager.Instance.FindByName_Down(baseActor.info.obj.transform, "collider_Head");
        baseActor.info.tranSpine1 = ActorManager.Instance.FindByName_Down(baseActor.info.obj.transform, "Bip001 Spine1");
        baseActor.info.mainCamera = ActorManager.Instance.FindByName_Down(baseActor.info.obj.transform, "Main Camera");
        aniControl.baseActor = baseActor;

        aniControl.headUI_point = ActorManager.Instance.FindByName_Down(baseActor.info.obj.transform, "headUI");

        m_ActorList.Add(baseActor);
    }    
Esempio n. 23
0
 public void SetOwner(BaseActor Target)
 {
     if (!IsOwnedBy(Target))
     {
         m_Target = Target;
     }
 }
Esempio n. 24
0
 public void AddControllableActor(BaseActor actor, bool autoSelectNextAvailableActor = false)
 {
     playerActors.Add(actor);
     if (autoSelectNextAvailableActor)
     {
         SelectFirstAvailableActor();
     }
 }
Esempio n. 25
0
 public void TestNullBehavior()
 {
     TestLauncherActor.Test(() =>
     {
         var actor = new BaseActor(new NullBehavior());
         actor.SendMessage("delta");
     });
 }
        private void UpdateTreeName(BaseActor actor)
        {
            var node = treeViewHierarchy.Nodes.Find(actor.Id, true).FirstOrDefault();

            treeViewHierarchy.BeginUpdate();
            node.Text = actor.Name;
            treeViewHierarchy.EndUpdate();
        }
Esempio n. 27
0
    public virtual BaseProjectile FireProjectile(BaseActor owner, GameObject projectilePrefab, Vector3 startPos, Vector3 dir, float speed, Quaternion rotation, bool optAddTorque = true)
    {
        GameObject     projectileObj = GameManager.Instance.SpawnPrefab(projectilePrefab, startPos, rotation);
        BaseProjectile projectile    = projectileObj.GetComponent <BaseProjectile>();

        projectile.Throw(owner, startPos, dir, speed, optAddTorque);
        return(projectile);
    }
Esempio n. 28
0
    void Awake()
    {
        GameObject _obj = GameObject.Find("PlayerObject");

        _actor               = _obj.GetComponent("BaseActor") as BaseActor;
        _currentSpeed        = _actor.GetMoveSpeed();
        _characterController = _obj.GetComponent("CharacterController") as CharacterController;
    }
Esempio n. 29
0
    void Awake()
    {
        _offset = new Vector3(0.0f, 1.0f, -5.0f);
        _camera = GameObject.Find("Main Camera").GetComponent("Camera") as Camera;
        GameObject playerObject = GameObject.Find("PlayerObject");

        PlayerTransform = playerObject.transform;
        _playerActor    = playerObject.GetComponent("BaseActor") as BaseActor;
    }
Esempio n. 30
0
 public virtual void Update()
 {
     BaseActor[] _actors = new BaseActor[Actors.Count];
     Actors.CopyTo(_actors);
     foreach (BaseActor baseActor in _actors)
     {
         baseActor.Update();
     }
 }
Esempio n. 31
0
        public DicomQueryRetrieveClient(BaseActor parentActor, ActorNameEnum actorName)
            : base(parentActor, actorName)
        {
            _presentationContexts = new PresentationContext[1];

            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.3.1.2.3.3", // Abstract Syntax Name
                "1.2.840.10008.1.2"); // Transfer Syntax Name(s)
            _presentationContexts[0] = presentationContext;
        }
Esempio n. 32
0
        public DicomStorageCommitClient(BaseActor parentActor, ActorNameEnum actorName)
            : base(parentActor, actorName)
        {
            _presentationContexts = new PresentationContext[1];

            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.1.20.1", // Abstract Syntax Name
                "1.2.840.10008.1.2"); // Transfer Syntax Name(s)
            _presentationContexts[0] = presentationContext;
        }
Esempio n. 33
0
 public void PickUp(Transform holdPoint)
 {
     m_thrower        = null;
     m_isBeingCarried = true;
     transform.parent = holdPoint;
     transform.DOLocalMove(Vector3.zero, 0.25f, true).SetDelay(0.25f);
     transform.DOLocalRotate(Vector3.zero, 0.25f);
     RemoveRigidbody();
 }
Esempio n. 34
0
        public DicomStorageClient(BaseActor parentActor, ActorNameEnum actorName) : base(parentActor, actorName)
        {
            _presentationContexts = new PresentationContext[1];

            PresentationContext presentationContext = new PresentationContext("1.2.840.10008.3.1.2.3.3", // Abstract Syntax Name
                                                                              "1.2.840.10008.1.2");      // Transfer Syntax Name(s)

            _presentationContexts[0] = presentationContext;
        }
Esempio n. 35
0
        public void Sort(BaseActor baseActor, List<BaseActor> actorList)
        {
            list.Clear();
            tarBaseActor = baseActor;

            for (int i = actorList.Count - 1; i >= 0; i--)
                list.Add(actorList[i]);

            list.Sort();//从小到大
        }
Esempio n. 36
0
    public virtual void OnDeath(int pDamage = 0, BaseActor pKiller = null)
    {
        whoHit.Clear();

        isAlive = false;

        if(onDeathCallback != null)
            onDeathCallback(this);

        onDeathCallback = null;
    }
Esempio n. 37
0
    void LoadFireAudio(BaseActor baseActor, GameObject objBullet)
    {
        if (Global.Instance.gameCommonConfig.music == false) return;

        GameObject obj = Global.Instance.srcManager.SynLoadSrc(SrcManager.ESrcType.Init, "Audio/shoot", typeof(GameObject)) as GameObject;
        GameObject.Destroy(obj, (float)objBullet.GetComponent<Bullet>().ballisticDate.flyTime * 2.0f);

        obj.transform.localPosition = baseActor.info.m_GunList[baseActor.info.useGunIndex].info.obj.GetComponent<GunScript>().firePoint.transform.position;
        obj.GetComponent<AudioSource>().minDistance = 2.0f;
        obj.GetComponent<AudioSource>().volume = 1.0f;
        obj.GetComponent<AudioSource>().playOnAwake = false;
        //obj.GetComponent<AudioSource>().PlayOneShot(obj.GetComponent<AudioSource>().clip);
        obj.GetComponent<AudioSource>().Play();
    }
Esempio n. 38
0
    public virtual void Throw(BaseActor owner, Vector3 startPos, Vector3 dir, float speed, bool addTorque = true)
    {
        mOwner = owner;
        mRigidbody.position = startPos;
        mLastPos = startPos;
        if (addTorque)
        {
            mRigidbody.AddTorque(Random.onUnitSphere * 10.0f);
        }
        mRigidbody.AddForce(dir * speed, ForceMode.VelocityChange);
        if(owner != null && owner.mCollider != null && mCollider != null)
        {
            Physics.IgnoreCollision(owner.mCollider, mCollider);
        }

        StartAutoDestruction();
    }
Esempio n. 39
0
        //public bool isHit;
        public void Init(BaseActor baseActor, Color star, Color end)
        {
            GameObject obj = new GameObject();
            foreach (Transform tran in obj.GetComponentsInChildren<Transform>())
            {
                //遍历当前物体及其所有子物体
                tran.gameObject.layer = LayerMask.NameToLayer("Scene");//更改物体的Layer层
            }

            //obj.transform.parent = baseActor.info.m_GunList[baseActor.info.useGunIndex].info.obj.transform;
            obj.transform.parent = baseActor.info.obj.transform;
            lineRenderer = obj.AddComponent<LineRenderer>();
            lineRenderer.SetWidth(0.02f, 0.02f);
            lineRenderer.SetVertexCount(2);
            //设置材质
            lineRenderer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
            lineRenderer.SetColors(star, end);
            lineRenderer.enabled = false;
        }
Esempio n. 40
0
    //增加动画事件
    public void AddEvent(BaseActor baseActor, string animationName, EEventType eventType)
    {
        switch (eventType)
        {
            case EEventType.SwapGun:
                {
                    IAction act = ScriptableObject.CreateInstance<IAction>();
                    act.name = EEventType.SwapGun.ToString();
                    act.eventType = (int)EEventType.SwapGun;
                    act.baseActor = baseActor;

                    AnimationEvent evt = new AnimationEvent();                    
                    evt.time = 0.5f;
                    evt.functionName = "OnAnimationEvent";
                    evt.objectReferenceParameter = act as Object;
                    animation.GetClip(animationName).AddEvent(evt);
                }
                break;
            default:
                break;
        }
    }
Esempio n. 41
0
    public void OnSwapGunBegin(BaseActor baseActor)
    {
        if (Global.Instance.battle.BattleUI.GetComponent<BattleUI>().Center.GetComponent<Button_Center>().fireControl.isPress)
                return;
        if (_eESwapGunState != ESwapGunState.END)
            return;

        if (_eESwapBulletState != ESwapBulletState.END)
            return;

        this.baseActor = baseActor;
        _eESwapGunState = ESwapGunState.DOWN;

        iTween.StopByName(baseActor.info.m_GunList[baseActor.info.useGunIndex].info.obj, "Swap_gun_down");
        iTween.StopByName(baseActor.info.m_GunList[baseActor.info.useGunIndex].info.obj, "Swap_gun_up");

        Hashtable hashtable = new Hashtable();
        hashtable.Add("name", "Swap_gun_down");
        hashtable.Add("time", 0.275f);
        hashtable.Add("x", 30.0f);
        hashtable.Add("islocal", true);
        hashtable.Add("oncomplete", "OnSwapGunModel");
        hashtable.Add("oncompletetarget", gameObject);
        iTween.RotateTo(gameObject, hashtable);

        //发消息
        LoginMsg.C2S_Actor_Animation msg = new LoginMsg.C2S_Actor_Animation();
        msg.animatiom = "SwapGun";
        msg.roomNum = baseActor.info.roomID;
        baseActor.info.sendAnimationNum++;
        msg.num = baseActor.info.sendAnimationNum;

        LoginServerManager.Instance.Server.SendMessage(baseActor.info.guid, ICmdNum.CmdNum.CS_Actor_Animation, msg, LoginServerManager.Instance.sendTime.interval_3, LoginServerManager.Instance.sendTime.count_3);
        
        //动画
        baseActor.info.obj.GetComponent<AnimationControl>().SwapGun();        
    }
Esempio n. 42
0
    //public void UnInit()
    //{
    //    StopCoroutine(AnimationStateMachine());
    //}

    void Update()
    {
        if (!agent.enabled)
        {
            Init();
        }

        //鼠标左键点击  
        //if (Input.GetMouseButtonDown(0))
        //{
        //    //摄像机到点击位置的的射线  
        //    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        //    RaycastHit hit;
        //    if (Physics.Raycast(ray, out hit))
        //    {
        //        //判断点击的是否地形  
        //        //if (hit.collider.tag.Equals("Obstacle"))
        //        //{
        //        //    begin = true;
        //        //    //点击位置坐标  
        //        //    target = hit.point;
        //        //}
        //        begin = true;
        //        //点击位置坐标  
        //        target = hit.point;
        //    }
        //}
        if (begin)//代理生效并且初始化.
        {
            #region
            if (ActorManager.Instance.controlActor.info.guid == anictr.baseActor.info.aiControlBaseActorId)//控制角色是NPC的AI托管
            {
                //每一帧,设置目标点 
                if (Time.time - timeBegin > timeDelta)
                {
                    timeBegin = Time.time;
                    //寻找视线内目标
                    BaseActor tar = ActorManager.Instance.FindBaseActor(anictr.baseActor, true, npcai.ai.view_distance, npcai.ai.angle);                    
                    if (tar != null)
                    {
                        if (tar != curTarBaseActor)
                        {
                            curTarBaseActor = tar;

                            //发送消息
                            LoginMsg.C2S_NPC_Move_Target msg = new LoginMsg.C2S_NPC_Move_Target();
                            msg.tarId = tar.info.guid;
                            msg.npcId = anictr.baseActor.info.guid;
                            msg.roomNum = ActorManager.Instance.controlActor.info.roomID;
                            tar.info.sendMoveNum++;
                            msg.num = tar.info.sendMoveNum;

                            LoginServerManager.Instance.Server.SendMessage(ActorManager.Instance.controlActor.info.guid, ICmdNum.CmdNum.CS_NPC_Move_Target, msg, LoginServerManager.Instance.sendTime.interval_4, LoginServerManager.Instance.sendTime.count_4);
                        }
                    }
                    else
                    {
                        curTarBaseActor = null;

                        //旋转到视线内出现敌人的角度
                        if (anictr.IsPlayStop())
                        {
                            BaseActor near = ActorManager.Instance.FindNearBaseActor(anictr.baseActor, true, npcai.ai.view_distance);

                            if(near != null)
                            {
                                Quaternion rotate = Quaternion.LookRotation(near.info.obj.transform.position - anictr.baseActor.info.obj.transform.position);
                                anictr.baseActor.info.obj.transform.rotation = Quaternion.Slerp(anictr.baseActor.info.obj.transform.rotation, rotate, Time.deltaTime * (1.0f / 0.333f));
                            }                            
                        }                            
                    }
                        
                }  

                if (curTarBaseActor != null)
                {
                    agent.SetDestination(curTarBaseActor.info.obj.transform.position);
                    //anictr.baseActor.info.tranSpine1.GetComponent<LookatTarget>().target = curTarBaseActor.info.obj.transform.position;
                }
            }
            else if (curTarBaseActor != null)//非控制角色
            {                
                agent.SetDestination(curTarBaseActor.info.obj.transform.position);
                //anictr.baseActor.info.tranSpine1.GetComponent<LookatTarget>().target = curTarBaseActor.info.obj.transform.position;
            }
            #endregion
        }        
    }
Esempio n. 43
0
 public void MoveMsgPro(BaseActor tarBaseactor)
 {
     curTarBaseActor = tarBaseactor;
 }
Esempio n. 44
0
 public BaseController(BaseActor actor)
 {
     Actor = actor;
     Actor.Attach(this);
 }
Esempio n. 45
0
 // Metodo para aplicacao de Dano
 public virtual void DoDamage(int pDamage, BaseActor pTarget)
 {
     if(pTarget.isAlive)
         pTarget.ReceiveDamage(pDamage, this);
 }
Esempio n. 46
0
    public BaseActor FindNearBaseActor(BaseActor lookActor, bool friendly, float endLen)
    {
        _findEnemyControl.Sort(lookActor, m_ActorList);

        for (int i = 0; i < _findEnemyControl.list.Count; i++)
        {
            //死亡的不做目标
            if (_findEnemyControl.list[i].info.die)
                continue;

            if (_findEnemyControl.list[i].info.friendly == friendly)
            {
                _findEnemyControl.ver = _findEnemyControl.list[i].info.mainCamera.position - lookActor.info.mainCamera.position;
                _findEnemyControl.len = _findEnemyControl.ver.magnitude;
                if (_findEnemyControl.len >= endLen)
                    continue;

                //检测场景和敌人
                Vector3 direction = _findEnemyControl.list[i].info.tranHead.position - lookActor.info.mainCamera.position;
                float length = endLen;
                RaycastHit hitinfo;
                bool isCollider = Physics.Raycast(lookActor.info.mainCamera.position, direction, out hitinfo, length, (1 << LayerMask.NameToLayer("Scene") | 1 << LayerMask.NameToLayer("Friendly") | 1 << LayerMask.NameToLayer("Mine")));
                if (isCollider)
                {
                    //射到了角色身上 
                    if (hitinfo.collider.tag == "Player")
                    {
                        if (hitinfo.transform.parent)
                        {
                            Transform baseactorTrf = ActorManager.Instance.FindByName_Up(hitinfo.transform, "Bip001");
                            if (baseactorTrf.parent.GetComponent<AnimationControl>())
                            {
                                BaseActor hitBaseActor = baseactorTrf.parent.GetComponent<AnimationControl>().baseActor;
                                if (hitBaseActor == _findEnemyControl.list[i] && hitBaseActor.info.friendly == friendly)
                                {
                                    BaseActor findBaseActor = _findEnemyControl.list[i];
                                    _findEnemyControl.Clear();
                                    return findBaseActor;
                                }
                            }
                        }
                    }
                }
            }
        }

        _findEnemyControl.Clear();
        return null;
    }
Esempio n. 47
0
 public void RemoveActor(BaseActor bs)
 {
     m_ActorList.Remove(bs);
     bs.DestoryDate();
 }
Esempio n. 48
0
    //
    public void OnSwapBulletBegin(BaseActor baseActor)
    {
        if (_eESwapGunState != ESwapGunState.END)
            return;

        if (_eESwapBulletState != ESwapBulletState.END)
            return;

        this.baseActor = baseActor;

        _eESwapBulletState = ESwapBulletState.UP;

        Global.Instance.battle.BattleUI.GetComponent<BattleUI>().CrossFireReturn();

        Hashtable hashtable = new Hashtable();
        hashtable.Add("name", "Swap_bullet_up");
        hashtable.Add("time", 0.25f);
        hashtable.Add("x", 30.0f);
        hashtable.Add("islocal", true);
        hashtable.Add("oncomplete", "OnSwapBulletModel");
        hashtable.Add("oncompletetarget", gameObject);
        iTween.RotateTo(gameObject, hashtable);

        //发消息
        LoginMsg.C2S_Actor_Animation msg = new LoginMsg.C2S_Actor_Animation();
        msg.animatiom = "SwapBullet";
        msg.roomNum = baseActor.info.roomID;
        baseActor.info.sendAnimationNum++;
        msg.num = baseActor.info.sendAnimationNum;

        LoginServerManager.Instance.Server.SendMessage(baseActor.info.guid, ICmdNum.CmdNum.CS_Actor_Animation, msg, LoginServerManager.Instance.sendTime.interval_3, LoginServerManager.Instance.sendTime.count_3);

        //动画
        baseActor.info.obj.GetComponent<AnimationControl>().SwapBullet();
        
    }
Esempio n. 49
0
    public override void DoDamage(BaseActor pTarget)
    {
        //Debug.Log("Sword Do Damage");

        base.DoDamage (pTarget);
    }
Esempio n. 50
0
 public void Init(BaseActor baseActor)
 {
     drawLineGun.Init(baseActor, Color.yellow, Color.red);
     drawLineCamera.Init(baseActor, Color.blue, Color.blue);
 }
Esempio n. 51
0
 public virtual BaseProjectile FireProjectile(BaseActor owner, GameObject projectilePrefab, Vector3 startPos, Vector3 dir, float speed, Quaternion rotation, bool optAddTorque = true)
 {
     GameObject projectileObj = GameManager.Instance.SpawnPrefab(projectilePrefab, startPos, rotation);
     BaseProjectile projectile = projectileObj.GetComponent<BaseProjectile>();
     projectile.Throw(owner, startPos, dir, speed, optAddTorque);
     return projectile;
 }
Esempio n. 52
0
 public DicomWorklistServer(BaseActor parentActor, ActorNameEnum actorName)
     : base(parentActor, actorName)
 {
 }
Esempio n. 53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpriteManager"/> class.
 /// </summary>
 /// <param name="a">
 /// The Base Actor
 /// </param>
 protected SpriteManager(BaseActor a)
 {
     this.Actor = a;
 }
Esempio n. 54
0
 public void Clear()
 {
     list.Clear();
     tarBaseActor = null;
 }
Esempio n. 55
0
 public RoamingController(BaseActor actor)
     : base(actor)
 {
 }
Esempio n. 56
0
 public virtual void OnMurder(BaseActor pVictim)
 {
     Debug.Log (this.name + " matou " +  pVictim.name);
 }
Esempio n. 57
0
 public FightController(BaseActor actor)
     : base(actor)
 {
 }
Esempio n. 58
0
    public void Run(BaseActor.DirState dirState)
    {
        string aniName = "";
        switch (dirState)
        {
            case BaseActor.DirState.forward:
                {
                    aniName = Enum.GetName(typeof(Gun.Num), baseActor.info.m_GunList[baseActor.info.useGunIndex].info.num) + "_" + Enum.GetName(typeof(State), State.Walk_Up);
                }
                break;
            case BaseActor.DirState.back:
                {
                    aniName = Enum.GetName(typeof(Gun.Num), baseActor.info.m_GunList[baseActor.info.useGunIndex].info.num) + "_" + Enum.GetName(typeof(State), State.Walk_Down);
                }
                break;
            case BaseActor.DirState.left:
                {
                    aniName = Enum.GetName(typeof(Gun.Num), baseActor.info.m_GunList[baseActor.info.useGunIndex].info.num) + "_" + Enum.GetName(typeof(State), State.Walk_Left);
                }
                break;
            case BaseActor.DirState.right:
                {
                    aniName = Enum.GetName(typeof(Gun.Num), baseActor.info.m_GunList[baseActor.info.useGunIndex].info.num) + "_" + Enum.GetName(typeof(State), State.Walk_Right);
                }
                break;
            default:
                break;
        }

        if (BaseActor.DirState.back == dirState)
            animation[aniName].speed = -1.0f;
        else if (animation[aniName].speed < 0.0f)
            animation[aniName].speed = 1.0f;
        if (!animation.IsPlaying(aniName))
            animation.CrossFade(aniName);

        if (gameObject == ActorManager.Instance.controlActor.info.obj)
            ActorManager.Instance.controlActor.info.gunBindPoint.GetComponent<TweenPosition>().enabled = true;
    }
Esempio n. 59
0
    // Metodo para recebicao de Dano
    public virtual void ReceiveDamage(int pDamage, BaseActor pBully)
    {
        if(!whoHit.Contains(pBully)){
            onDeathCallback += pBully.OnMurder;
            whoHit.Add(pBully);
        }

        currentLife -= pDamage;

        if(currentLife <= 0)
            OnDeath();
    }
Esempio n. 60
0
 public DisplayController(BaseActor actor)
     : base(actor)
 {
 }