protected override void OnInvokeStart() { base.OnInvokeStart(); controller = target.GetComponent<ActorController>(); controller.actionLocked = true; }
protected override void DoAction() { this.index = 0; this.tickTimer = this.TickInterval; this.moveTarget = null; if (this.DamagePrefab == null) { global::Debug.LogError(new object[] { "DamagePrefab error!" }); return; } Vector3 vector = base.variables.skillCaster.transform.position; if (base.variables.skillTarget != null) { vector = base.variables.skillTarget.transform.position; vector -= base.variables.skillCaster.transform.forward * this.ForwardOffset; } Transform transform = PoolMgr.SpawnParticleSystem(this.DamagePrefab.transform, vector, base.variables.skillCaster.transform.rotation, 1f); this.missile = transform.gameObject; if (this.missile == null) { global::Debug.LogError(new object[] { "Instantiate DamagePrefab object error!" }); return; } this.MoveToNextTarget(); }
protected void DoInstantiate(ActorController actor, string socketName, bool onlyUseSocketPosition) { this.DoInstantiate(actor); if (this.go != null && !string.IsNullOrEmpty(socketName)) { GameObject gameObject = ObjectUtil.FindChildObject(actor.gameObject, socketName); if (gameObject == null) { return; } if (onlyUseSocketPosition) { this.go.transform.position = gameObject.transform.position; } else { Transform transform = this.go.transform; transform.parent = gameObject.transform; transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; transform.localScale = Vector3.one; actor.AddPoolSocket(transform); } } }
protected void CheckBossDialog(bool flag = true) { if (this.findBossDialogID != 0) { return; } if (this.bossActor == null) { this.bossActor = this.actorMgr.GetBossActor(); } if (this.bossActor == null || !this.bossActor.gameObject.activeInHierarchy) { return; } if (this.actorMgr.PlayerCtrler.ActorCtrler != null && (flag || this.actorMgr.PlayerCtrler.ActorCtrler.GetDistance2D(this.bossActor) < 4.5f)) { QuestInfo info = Globals.Instance.AttDB.QuestDict.GetInfo(this.senceInfo.ID); if (info != null && Globals.Instance.Player.GetQuestState(this.senceInfo.ID) == 0) { this.findBossDialogID = info.SceneBossDialogID; } if (this.findBossDialogID != 0 && this.status == 2 && !GameCache.HasDialogShowed(this.findBossDialogID)) { if (!flag) { this.timer = 0.001f; } else { this.timer = 1f; } } } }
/// <summary> /// Sets the new actor that is being controlled /// </summary> /// <param name="rActor"></param> public void SetActor(ActorController rActor) { if (rActor == null) { return; } if (Actor != null) { ActorDriver lOldDriver = Actor.gameObject.GetComponent<ActorDriver>(); if (lOldDriver != null) { lOldDriver.IsEnabled = false; } } ActorDriver lNewDriver = rActor.gameObject.GetComponent<ActorDriver>(); if (lNewDriver != null) { lNewDriver.IsEnabled = true; } Actor = rActor; if (mCameraRig != null) { mCameraRig.Anchor = Actor.transform; } else if (mCamera != null) { mCamera.transform.parent = Actor.transform; mCamera.transform.localPosition = new Vector3(0f, 1.5f, -4f); Vector3 lLookTarget = Actor.transform.position + (Actor.transform.up * 1f); mCamera.transform.rotation = Quaternion.LookRotation(lLookTarget - mCamera.transform.position, Actor.transform.up); } if (mActorText != null && mActorDescriptions.ContainsKey(rActor.gameObject.name)) { mActorTextTimer = 0f; mActorText.text = mActorDescriptions[rActor.gameObject.name]; mActorText.enabled = true; } }
protected override void OnInvokeStart() { base.OnInvokeStart(); controller = source.GetComponent<ActorController>(); controller.actor.body.SetAnimatorThrow(); }
protected override void OnInvokeStart() { base.OnInvokeStart(); controller = source.GetComponent<ActorController>(); controller.actor.Turn(angleDegrees); }
public static ActorController FindMinDistEnemy(ActorController actor, float findDist) { if (actor == null) { return null; } float num = 3.40282347E+38f; ActorController result = null; List<ActorController> actors = Globals.Instance.ActorMgr.Actors; for (int i = 0; i < actors.Count; i++) { ActorController actorController = actors[i]; if (actorController && !actorController.IsDead && (!actorController.IsImmunity || actorController.ActorType != ActorController.EActorType.EMonster) && actor.IsHostileTo(actorController)) { float num2 = actor.GetDistance2D(actorController); if (num2 <= findDist) { if (actorController.ActorType == ActorController.EActorType.EPlayer) { num2 *= 1.5f; if (num2 < 1.5f) { num2 = 1.5f; } } if (num2 < num) { num = num2; result = actorController; } } } } return result; }
public override void Exit() { if (this.Target != null) { this.Target.AiCtrler.ReleaseChaser(this.actorCtrler); } this.Target = null; }
protected override void OnInvokeStart() { base.OnInvokeStart(); controller = source.GetComponent<ActorController>(); controller.actor.physics.velocity += Vector3.up * force; AudioManager.Instance.PlayOneShot(controller.actor.audioSource, AudioManager.Instance.jump); }
protected override void OnInvokeStart() { base.OnInvokeStart(); controller = source.GetComponent<ActorController>(); Ball ball = Field.Instance.ball; controller.actor.TryTakePossession(ball, this.range); }
public static void ChangeControllerGloss(ActorController controller, Color color, float gloss, float lerp, float hold) { List<CharacterMeshInfo> meshInfos = controller.MeshInfos; for (int i = 0; i < meshInfos.Count; i++) { CharacterMeshInfo characterMeshInfo = meshInfos[i]; characterMeshInfo.ChangeToColor(color, gloss, lerp, hold); } }
public void SetTarget(ActorController target, float attackDistance) { if (this.Target != null) { this.Target.AiCtrler.ReleaseChaser(this.actorCtrler); } this.Target = target; this.distance = attackDistance; }
protected override void OnInvokeStart() { base.OnInvokeStart(); controller = source.GetComponent<ActorController>(); controller.actor.body.SetAnimatorThrow(); Ball ball = Field.Instance.ball; controller.actor.TrySwatBall(ball, this.range, this.yRange); }
protected override void OnDespawned() { base.OnDespawned(); this.moveTarget = null; if (this.missile != null) { PoolMgr.spawnPool.Despawn(this.missile.transform); this.missile = null; } }
public void RequestShow(ActorController actor, EShowType showType, int value = 0, string text = null, int type = 0) { ShowData showData = new ShowData(); showData.actor = actor; showData.showType = showType; showData.type = type; showData.value = value; showData.text = text; this.textLists.Add(showData); }
public void Init(ActorController target) { if (target == null) { return; } this.mTargetUnit = target; this.mSizeY = ((!(this.mTargetUnit.collider == null)) ? this.mTargetUnit.collider.bounds.size.y : 0f); this.Show(); }
//List<Collider> ignore = new List<Collider>(); // Use this for initialization void Start() { Messenger.AddListener("start_voyage", SetCanRepel); capsuleCollider = GetComponent<CapsuleCollider>() as CapsuleCollider; actorController = transform.gameObject.GetComponent<ActorController>(); health = transform.GetComponent<Health>() as Health; //InvokeRepeating("CheckContact", 0, 0.05f); }
protected override void DoAction() { this.status = ChainSpiritAction.EStatus.ES_Effect; this.startTimestamp = this.MinLiftTime; this.nextActor = base.variables.skillTarget; Vector3 vector = Vector3.zero; base.variables.skillCaster.transform.position = new Vector3(vector.x, vector.y + this.YOffset,vector.z); if (this.nextActor == null) { this.nextActor = base.variables.skillCaster; } }
/// <summary> /// Once the objects are instanciated, awake is called before start. Use it /// to setup references to other objects /// </summary> protected virtual void Awake() { // Grab the actor controller so we can set it's values later mActorController = gameObject.GetComponent<ActorController>(); // Object that will provide access to the keyboard, mouse, etc if (InputSourceOwner != null) { mInputSource = InterfaceHelper.GetComponent<IInputSource>(InputSourceOwner); } // Default speed we'll use to rotate. To help smooth out the rotation, // We make it consistant even in low frame rates, by set the standard to be a // rotation if we're running at 60 frames per second. mDegreesPer60FPSTick = RotationSpeed / 60f; }
public void SetInfoLabel(ActorController actor, string strBoxInfo) { if (actor != null) { float num = (!(actor.gameObject.collider == null)) ? ((BoxCollider)actor.gameObject.collider).size.y : 0f; float y = actor.transform.position.y + num * actor.transform.localScale.y + 0.4f; this.initPosition = actor.transform.position; this.initPosition.y = y; Vector3 position = GameUIManager.mInstance.uiCamera.camera.ViewportToWorldPoint(Camera.main.WorldToViewportPoint(this.initPosition)); position.z = 0f; base.transform.position = position; this.mInfo.text = strBoxInfo; } }
public override void OnFindEnemy(ActorController enemy) { base.OnFindEnemy(enemy); if (!this.dialog) { this.dialog = true; base.StopAttack(); this.AllActorStop(); if (GameUIManager.mInstance.ShowPlotDialog(1002, new GUIPlotDialog.FinishCallback(this.DialogFinish), null)) { Globals.Instance.ActorMgr.Pause(true); } } }
protected override void DoAction() { this.status = ChainLightningAction.EStatus.ES_Effect; this.startTimestamp = this.MinLiftTime; this.nextActor = base.variables.skillTarget; Vector3 vector = base.variables.skillCaster.transform.position; vector.y += this.YOffset; vector += base.variables.skillCaster.transform.forward * this.ForwardOffset; if (this.HandPrefab != null) { GameObject obj = UnityEngine.Object.Instantiate(this.HandPrefab, vector, base.variables.skillCaster.transform.rotation) as GameObject; UnityEngine.Object.Destroy(obj, this.HandLifeTime); } }
protected void DoInstantiate(ActorController actor) { if (actor == null) { return; } Vector3 vector = actor.transform.position; if (!this.BaseOnFeet) { vector.y += ((BoxCollider)actor.collider).size.y; } vector.y += this.YOffset; vector += actor.transform.forward * this.ForwardOffset; this.DoInstantiate(vector, base.transform.rotation); }
public void InitWithActorController(ActorController target, string content, float showTime) { if (target == null) { return; } if (this.mContentDesc == null) { this.CreateObjects(); } this.mContentDesc.text = content; this.mTargetUnit = target; this.mSizeY = ((!(this.mTargetUnit.collider == null)) ? this.mTargetUnit.collider.bounds.size.y : 0f); this.mShowTipTimer = showTime; this.Show(); }
public void AttackTarget(ActorController target, int skillIndex, bool focusTarget = true) { if (this.curGoal != null) { this.curGoal.OnInterrupt(); this.curGoal = null; } if (this.attackTargetGoal == null) { this.attackTargetGoal = new GoalAttackTarget(this.actorCtrler); } if (!this.attackTargetGoal.SetAttackTarget(target, skillIndex, focusTarget)) { this.curGoal = this.attackTargetGoal; } }
public void OnLootMoneyEvent(ActorController actor, int money) { if (this.mBoxNoticePrefab != null) { GameObject gameObject = NGUITools.AddChild(GameUIManager.mInstance.uiCamera.gameObject, this.mBoxNoticePrefab); gameObject.AddComponent<UIIngameBoxNotice>().SetInfoLabel(actor, Singleton<StringManager>.Instance.GetString("lootNotice", new object[] { money })); Vector3 localPosition = gameObject.transform.localPosition; localPosition.z += 5000f; gameObject.transform.localPosition = localPosition; } this.mGoldNum += money; this.mGoldNumTxt.text = this.mGoldNum.ToString(); }
public bool SetAttackTarget(ActorController _target, int _skillIndex, bool _focusTarget) { if (_target == null || _target.IsDead) { return true; } this.target = _target; this.skillIndex = _skillIndex; this.focusTarget = _focusTarget; this.actorCtrler.AiCtrler.Locked = true; if (this.focusTarget) { Globals.Instance.ActorMgr.SetSelectTarget(_target); } return this.TryTestGoal(); }
protected override void OnDespawned() { base.OnDespawned(); for (int i = 0; i < this.missileList.Count; i++) { if (this.missileList[i] != null && this.missileList[i].lightning != null) { UnityEngine.Object.Destroy(this.missileList[i].lightning.gameObject); } } this.oldActorList.Clear(); this.missileList.Clear(); this.nextActor = null; this.startTimestamp = 0f; this.status = ChainLightningAction.EStatus.ES_None; this.timer = 0f; }
private void Start() { this.acc = base.GetComponent<ActorController>(); if (this.acc == null) { Transform parent = base.transform.parent; while (parent != null) { this.acc = parent.GetComponent<ActorController>(); if (this.acc != null) { break; } parent = parent.parent; } } }
private void AssignGameObject(string trackedName, Transform newTransform) { if (!arObjects.ContainsKey(trackedName)) { arObjects[trackedName] = Instantiate(arPrefabs[trackedName]); arObjects[trackedName].transform.SetParent(transform); if (trackedName.Contains("fighters")) { actor = arObjects[trackedName].GetComponent <ActorController>(); } } GameObject goARObject = arObjects[trackedName]; goARObject.SetActive(true); goARObject.transform.position = newTransform.position; goARObject.transform.rotation = newTransform.rotation; }
private void FindPathForSelectionHexOnEditor() { //ShortestPathToZero startPath; //List<ShortestPathToZero> openList = new List<ShortestPathToZero>(); //List<ShortestPathToZero> closeList = new List<ShortestPathToZero>(); ////_closeList.Clear(); ////_openList.Clear(); //CurrentPath.Clear(); //HexagonNode node = new HexagonNode(_selectionHex.position, CellSize, MapSize); //startPath = new ShortestPathToZero(node, MoveCost, node.Magnitude, null); //_closeList.Add(startPath); ActorController selectedActor = _selectionHex.GetComponent <ActorController>(); //selectedActor.FindPath(); CurrentPath = selectedActor.CurrentPath; }
static void DeleteActor() { long id = GetId(); if (id < 0) { return; } if (ActorController.Delete(id)) { Console.WriteLine("DELETE"); } else { Console.WriteLine("NO RECORD"); } }
// Update is called once per frame void Update() { player = FindObjectOfType <ActorController> (); Debug.DrawLine(new Vector3(transform.position.x - playerRange, transform.position.y, transform.position.z), new Vector3(transform.position.x + playerRange, transform.position.y, transform.position.z)); shotCounter -= Time.deltaTime; if (transform.localScale.x < 0 && player.transform.position.x > transform.position.x && player.transform.position.x < transform.position.x + playerRange && shotCounter < 0) { Instantiate(enemyProjectile, launchPoint.position, launchPoint.rotation); shotCounter = waitBetweenShots; } if (transform.localScale.x > 0 && player.transform.position.x < transform.position.x && player.transform.position.x > transform.position.x - playerRange && shotCounter < 0) { Instantiate(enemyProjectile, launchPoint.position, launchPoint.rotation); shotCounter = waitBetweenShots; } }
/// <summary> /// Sets the message that will be run each time damage should be processed /// </summary> /// <param name="rMessage">Message containing information about the damage</param> /// <param name="rTriggerDelay">Time in seconds between triggering</param> /// <param name="rMaxAge">Max amount of time the effect can last</param> public override void Activate(float rTriggerDelay, float rMaxAge) { bool lActivated = false; // Check if we can modify the movement each frame mActorController = mActorCore.gameObject.GetComponent <ActorController>(); if (mActorController != null) { // If we are in control of movement, this is a bit easier if (!mActorController.UseTransformPosition) { lActivated = true; mActorController.OnPreControllerMove += OnControllerMoved; } } // If we couldn't use the Actor Controller, let's see if we can use a nav mesh angent if (!lActivated) { mNavMeshDriver = mActorCore.gameObject.GetComponent <NavMeshDriver>(); if (mNavMeshDriver != null) { lActivated = true; mOriginalSpeed = mNavMeshDriver.MovementSpeed; mNavMeshDriver.MovementSpeed = mNavMeshDriver.MovementSpeed * _MovementFactor; } } // If we couldn't use the Actor Controller, let's see if we can use a nav mesh angent if (!lActivated) { mNavMeshAgent = mActorCore.gameObject.GetComponent <NavMeshAgent>(); if (mNavMeshAgent != null) { lActivated = true; mOriginalSpeed = mNavMeshAgent.speed; mNavMeshAgent.speed = mNavMeshAgent.speed * _MovementFactor; } } base.Activate(rTriggerDelay, rMaxAge); }
/// <summary> /// Recreate the default body shapes on the character's ActorController /// </summary> /// <param name="rMotionController"></param> public static void CreateDefaultBodyShapes(MotionController rMotionController) { ActorController lActorController = rMotionController.GetOrAddComponent <ActorController>(); lActorController.BodyShapes.Clear(); BodyCapsule lCapsule = new BodyCapsule { _Parent = lActorController.transform, Name = "Body Capsule", Radius = 0.3f, Offset = new Vector3(0f, 0.6f, 0f), IsEnabledOnGround = true, IsEnabledOnSlope = true, IsEnabledAboveGround = true, EndTransform = lActorController.transform.FindTransform(HumanBodyBones.Head) }; if (lCapsule.EndTransform == null) { lCapsule.EndTransform = lActorController.transform.FindTransform("Head"); } if (lCapsule.EndTransform == null) { lCapsule.EndOffset = new Vector3(0f, 1.6f, 0f); } lActorController.BodyShapes.Add(lCapsule); BodySphere lSphere = new BodySphere { _Parent = lActorController.transform, Name = "Foot Sphere", Radius = 0.25f, Offset = new Vector3(0f, 0.25f, 0f), IsEnabledOnGround = false, IsEnabledOnSlope = false, IsEnabledAboveGround = true }; lActorController.BodyShapes.Add(lSphere); // Save the new body shapes lActorController.SerializeBodyShapes(); }
protected void OnCollisionEnter(Collision collision) { ActorController otherActor = collision.gameObject.GetComponent <ActorController>(); if (otherActor != null) { print("collided!"); if (IsTagged) { if (LastPlayerTagged.lastPlayerTagged != otherActor.gameObject) { LastPlayerTagged.lastPlayerTagged = gameObject; otherActor.onActorTagged(true); onActorTagged(false); } } } }
public ActorController Do() { ActorController taggedActor = null; RaycastHit[] hits = Physics.SphereCastAll(ControlledAI.transform.position, acceptableDistance, Vector3.forward); foreach (RaycastHit hit in hits) { if (hit.transform.gameObject.GetComponent <ActorController>()) { if (hit.transform.gameObject.GetComponent <ActorController>() != ControlledAI && hit.transform.gameObject.GetComponent <ActorController>().IsTagged&& !ControlledAI.LastTagged) { taggedActor = hit.transform.gameObject.GetComponent <ActorController>(); } } } return(taggedActor); }
public void CreateNewActor(Actor actor, Vector3 pos) { GameObject actorObj = (GameObject)Object.Instantiate(Resources.Load("GameScene/Actor")); int actorId = this.GenerateNewActorId(); actorObj.transform.name = "Actor_" + actorId.ToString("D3"); actorObj.transform.localScale = new Vector3(1, 1, 1); actorObj.transform.position = pos; ActorController actorCtrl = actorObj.GetComponent <ActorController>(); actor.ActorId = actorId; actorCtrl.TargetBuilding = BuildingsManager.GetInstance() .GetBaseBuildingOfFaction(actor.FactionType == FactionType.Blue ? FactionType.Red : FactionType.Blue); actorCtrl.ActorPath = ActorPathManager.GetInstance() .GenerateNewPath(pos, actorCtrl.TargetBuilding.transform.position); actorCtrl.MyActor = actor; this.actorsDictionary.Add(actorId, actorObj); }
/// <summary> /// Called to initialize the actor when it's the local actor /// </summary> protected void LocalStart() { // Disable the 'Use Transform' option ActorController lActorController = gameObject.GetComponent <ActorController>(); lActorController.enabled = true; lActorController.UseTransformPosition = false; lActorController.UseTransformRotation = false; // Grab the MC and ensure it's enabled MotionController lMotionController = gameObject.GetComponent <MotionController>(); lMotionController.enabled = true; if (lMotionController.CameraRig != null) { lMotionController.CameraRig.Anchor = lMotionController._Transform; } }
/// <summary> /// Called when the object is selected in the editor /// </summary> private void OnEnable() { // Grab the serialized objects mTarget = (ActorController)target; mTargetSO = new SerializedObject(target); // Reinstanciate any of the body shapes mTarget.DeserializeBodyShapes(); // Create the list of body shapes InstanciateList(); // Generate the list of motions to display Assembly lAssembly = Assembly.GetAssembly(typeof(ActorController)); foreach (Type lType in lAssembly.GetTypes()) { if (lType.IsAbstract) { continue; } if (typeof(BodyShape).IsAssignableFrom(lType)) { mBodyShapeTypes.Add(lType); mBodyShapeNames.Add(StringHelper.FormatCamelCase(lType.Name)); } } // Initialize the component for the first time. if (!mTarget.EditorComponentInitialized) { if (mTarget.BodyShapes.Count == 0) { CreateDefaultShapes(); mTarget.EditorComponentInitialized = true; mIsDirty = true; } } // Refresh the layers in case they were updated EditorHelper.RefreshLayers(); }
public async Task GetActors_OkStatusCode_WithEmptyContext() { // Arrange var optionBuilder = new DbContextOptionsBuilder <AldoGiovanniGiacomoAPIContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var exmptyContext = new AldoGiovanniGiacomoAPIContext(optionBuilder.Options); var controller = new ActorController(exmptyContext, _logger); // Act var result = await controller.GetActors(); var okResult = result as OkObjectResult; var actors = okResult.Value as ICollection <ActorDTO>; //Assert Assert.NotNull(okResult); Assert.Equal(StatusCodes.Status200OK, okResult.StatusCode); Assert.Equal(0, actors.Count); }
void Awake() { ac = GetComponent <ActorController>(); GameObject model = ac.model; if (!ac.isTrigger) { GameObject sensor = transform.Find("sensor").gameObject; bm = Bind <BattleManager>(sensor); im = Bind <InterActionManager>(sensor); wm = Bind <WeaponManager>(model); } sm = Bind <StateManager>(gameObject); dm = Bind <DirectorManager>(gameObject); ac.OnAction += DoAction; ac.OnChangeDualHand += Ac_OnChangeDualHand; }
void Start() { cameraHandle = transform.parent.gameObject; playerHandle = cameraHandle.transform.parent.gameObject; tempEulerX = 20f; ActorController actorController = playerHandle.GetComponent <ActorController>(); model = actorController.model; pi = actorController.pi; if (!isAI) { mainCamera = Camera.main.gameObject; lockDot.enabled = false; Cursor.lockState = CursorLockMode.Locked; } lockState = false; }
public async Task CallActorServiceOnce_OnGet() { // Arrange var actorServiceMock = new Mock <IActorService>(); var actorsList = new List <ActorViewModel>(); actorServiceMock .Setup(g => g.GetAllActorsAsync()) .ReturnsAsync(actorsList); var sut = new ActorController(actorServiceMock.Object); // Act await sut.Index(); // Assert actorServiceMock.Verify(g => g.GetAllActorsAsync(), Times.Once); }
public async Task ReturnCorrectViewModel_OnGet() { // Arrange var actorServiceMock = new Mock <IActorService>(); var actorsList = new List <ActorViewModel>(); actorServiceMock .Setup(g => g.GetAllActorsAsync()) .ReturnsAsync(actorsList); var sut = new ActorController(actorServiceMock.Object); // Act var result = await sut.Index() as ViewResult; // Assert Assert.IsInstanceOfType(result.Model, typeof(ListActorViewModel)); }
public override void getAnimation(Actor actor) { ActorController Character = GetController(actor); float Rotation = Character.Cache.Rotation.z; Animator animator = actor.Animator; bool RifleTag = animator.GetCurrentAnimatorStateInfo(0).IsTag(VarCharacterAnim.Tag_Rifle); float cliptime = animator.GetCurrentAnimatorStateInfo(0).normalizedTime; if (Character.AIProcessor.FireRifle) { if ((Rotation > 270 || Rotation < 90)) { SetAnimator(VarCharacterAnim.D_Rifle, true); } if (Rotation < 270 && Rotation > 90) { SetAnimator(VarCharacterAnim.A_Rifle, true); } } else { SetAnimator(VarCharacterAnim.D_Rifle, false); SetAnimator(VarCharacterAnim.A_Rifle, false); } if (RifleTag && cliptime < .9f) { SetAnimator(VarCharacterAnim.Rifle, true); SetAnimator(VarCharacterAnim.Attack, true); } if (!RifleTag || (RifleTag && cliptime > .9f)) { SetAnimator(VarCharacterAnim.Rifle, false); SetAnimator(VarCharacterAnim.Attack, false); } void SetAnimator(string name, bool value) { animator.SetBool(name, value); } }
protected void OnCollisionEnter(Collision collision) { ActorController otherActor = collision.gameObject.GetComponent <ActorController>(); if (otherActor != null) { if (IsTagged) { if (otherActor != TaggedLast) { print(otherActor != TaggedLast); otherActor.onActorTagged(true); onActorTagged(false); TaggedLast = gameObject; } } } }
private void initList() { ActorController director = new ActorController(); for (int i = 0; i < 10; i++) { ActorBuilder builder = new RoleBuilder(roleControl); Actor a = director.Construct(builder); roles.Add(a); } for (int i = 0; i < 100; i++) { ActorBuilder guaiwub = new GuaiWuBuilder(guaiwuControl); Actor a = director.Construct(guaiwub); guaiwus.Add(a); } ActorBuilder self = new RoleBuilder(roleControl); selfRole = director.Construct(self); }
static void GetActorById() { long id = GetId(); if (id < 0) { return; } Actor actor = ActorController.GetById(id); if (actor != null) { TablePrinter <Actor> .Print(actor); } else { Console.WriteLine("NO RECORD"); } }
public override void DoStep(ActorController actor) { Vector3 diff = targetPosition - actor.transform.position; if (diff.magnitude <= actor.moveSpeed) { Debug.Log("Trying to get job reservation"); if (manager.GetJobReservation(actor)) { Debug.Log("Got job reservation"); Completed = true; return; } float r = 5.0f; targetPosition = center + new Vector3(UnityEngine.Random.Range(-r, r), 0, UnityEngine.Random.Range(-r, r)); targetPosition = actor.GameController.SnapToGround(targetPosition); diff = targetPosition - actor.transform.position; } actor.transform.position += diff * 0.08f * (actor.moveSpeed / diff.magnitude); }
public override void Awake() { if (mOwner != null) { if (mActorCore == null) { mActorCore = mOwner.GetComponent <ActorCore>(); } if (mActorController == null) { mActorController = mOwner.GetComponent <ActorController>(); } if (mNavMeshAgent == null) { mNavMeshAgent = mOwner.GetComponent <NavMeshAgent>(); } mInitialUseTransform = mActorController.UseTransformPosition; } }
private void CheckWinner() { ActorController actor = null, winner = null; foreach (ActorController player in players) { actor = player; if (winner == null) { winner = actor; } if (actor.TagsCount < winner.TagsCount) { print("Overwritten"); winner = actor; } } //print(string.Format("Winner is {0}, with {1} tags", actor.gameObject.name, actor.TagsCount)); UIManager.UiInstance.GraphWinner("Winner is " + winner.gameObject.name + ", with " + winner.TagsCount + " tags"); }
public async Task GetActor_OkStatusCode_WithValidId() { // Arrange var controller = new ActorController(_context, _logger); // Act var result = await controller.GetActor(1); var okResult = result as OkObjectResult; var actor = okResult.Value as ActorDTO; //Assert Assert.NotNull(okResult); Assert.Equal(StatusCodes.Status200OK, okResult.StatusCode); Assert.Equal(1, actor.Id); Assert.Equal("Aldo", actor.Name); Assert.Equal("Baglio", actor.Surname); Assert.Equal("Palermo", actor.BirthPlace); Assert.Equal(new DateTime(1958, 9, 28), actor.Birth); }
public ActorController GetActor() { players = FindObjectsOfType <ActorController>(); distanceFromPlayer = Mathf.Infinity; //ControlledAI.victim = players[0]; foreach (ActorController player in players) { if (player != gameObject.GetComponent <ActorController>() && player != GameController.ControllerInstance.lastTagged) { if (Vector3.Distance(transform.position, player.transform.position) < distanceFromPlayer) { distanceFromPlayer = Vector3.Distance(player.transform.position, transform.position); victim = player; //ControlledAI.victim = player; print("Got Victim"); } } } return(victim); }
public void GetComponentsCallback() { Debug.Log("Get Components of cc and model"); if (character != null) { actorController = character.GetComponent <ActorController>(); actorController.Init(); if (!actorController.model.character) { actorController.model.character = character.transform.GetChild(0).gameObject; } cc = character.GetComponent <CharacterController>(); hitbox = actorController.model.hitBox; hurtbox = actorController.model.hurtBox; timeline.Init(); behaviorInfo.Init(); behaviorSelector.Init(); } }
static void UpdateActor() { long id = GetId(); if (id < 0) { return; } Actor actor = GetActor(); if (ActorController.Update((int)id, actor)) { Console.WriteLine("UPDATE"); } else { Console.WriteLine("NO RECORD"); } }
public void Shoot(Vector3 TargetLocation) { if (Time.time > LastShotTime + SecondsBetweenShots) { Vector3 shootRayOrigin = GetShootOrigin(); Vector3 shootRayDirection = (TargetLocation - shootRayOrigin).normalized; if (Physics.Raycast(shootRayOrigin, shootRayDirection, out shootRaycastResult)) { Vector3 debugRayLength = shootRaycastResult.point - shootRayOrigin; Debug.DrawRay(shootRayOrigin, debugRayLength, new Color(1.0f, 0.0f, 0.0f), 0.2f, true); AkCustomTrigger gunshotSound = GetComponent <AkCustomTrigger>(); if (gunshotSound != null) { gunshotSound.TriggerSound(); } if (GunshotEffect != null) { Object gunshot = Instantiate(GunshotEffect, shootRayOrigin, transform.rotation); GameObject gunshotObject = (GameObject)gunshot; gunshotObject.transform.parent = GunEnd; gunshotObject.transform.localRotation = Quaternion.identity; gunshotObject.transform.localPosition = Vector3.zero; gunshotObject.transform.localScale = Vector3.one; gunshotObject.GetComponent <ParticleSystem>().Play(); Destroy(gunshotObject, gunshotObject.GetComponent <ParticleSystem>().main.duration + 0.5f); } GameObject objectHit = shootRaycastResult.collider.gameObject; ActorController actor = ObjectUtils.GetActorControllerFromObject(objectHit); if (actor != null) { actor.TakeHit(shootRaycastResult.point, ShotDamage, new BulletInfo(shootRayDirection * Knockback, 1.0f)); } } LastShotTime = Time.time; } }
public static void ExecuteEvent(Event value) { GameObject actorControllerGameObject = GameObject.FindGameObjectWithTag("ActorController"); ActorController actorController = actorControllerGameObject.GetComponent <ActorController>(); switch (value) { case Event.Angry: Village.Emotion = Emotion.Angry; actorController.SetEmotion(Emotion.Angry); break; case Event.AttackedEnglandWhileAngry: Village.AttackedEnglandWhileAngry = true; break; case Event.AttackedEnglandWhileSweatDrop: Village.AttackedEnglandWhileSweatDrop = true; break; case Event.Happy: Village.Emotion = Emotion.Happy; actorController.SetEmotion(Emotion.Happy); break; case Event.NoEmotion: Village.Emotion = Emotion.None; actorController.SetEmotion(Emotion.None); break; case Event.Shy: Village.Emotion = Emotion.Shy; actorController.SetEmotion(Emotion.Shy); break; case Event.SweatDrop: Village.Emotion = Emotion.SweatDrop; actorController.SetEmotion(Emotion.SweatDrop); break; } }
// Start is called before the first frame update void Awake() { ac = GetComponent <ActorController>(); GameObject model = ac.model; //GameObject npcSensor = transform.Find("npcSensor").gameObject; if (camIdentify.GetComponent <cameraController>().isAI == false) { GameObject sensor = transform.Find("sensor").gameObject; bm = Bind <BattleManager>(sensor); } else if (camIdentify.GetComponent <cameraController>().isAI) { GameObject sensor = transform.Find("npcSensor").gameObject; bm = Bind <BattleManager>(sensor); } wm = Bind <weaponManager>(model); sm = Bind <StateManager>(gameObject); }