public virtual void Add(object item) { ContainedObjects.Add(item); Bounds(); base.Distribute(0); }
public override void OnAfterDelete() { foreach (IEntity obj in ContainedObjects.ToList()) // toList necessary for enumeration modification { if (obj is Item) { ((Item)obj).Delete(); } else if (obj is ICrew) { ((ICrew)obj).Delete(); } else if (obj is Mobile) { ((Mobile)obj).Transport = null; } } if (CurrentMoveTimer != null) { CurrentMoveTimer.Stop(); } if (CurrentTurnTimer != null) { CurrentTurnTimer.Stop(); } this.TillerManMobile.Delete(); Instances.Remove(this); }
public virtual void Add(IEnumerable <object> items) { foreach (object item in items) { ContainedObjects.Add(item); } Bounds(); base.Distribute(0); }
protected override void OnHullStatusChange() { ContainedObjects.ForEachItem(item => { if (item is IRefreshItemID) { ((IRefreshItemID)item).RefreshItemID(m_CurrentItemIdModifier); } }); }
protected virtual void OnStatusChange() { ContainedObjects.ForEachItem(item => { if (item is IRefreshItemID) { ((IRefreshItemID)item).RefreshItemID(CurrentItemIdModifier); } }); }
public virtual void Add(IOctreeObject item) { if (item.GetOctreeBounds() == null) { return; } ContainedObjects.Add(item); Bounds(); base.Distribute(0); }
public virtual void Add(IEnumerable <IOctreeObject> items) { foreach (IOctreeObject item in items) { if (item.GetOctreeBounds() != null) { ContainedObjects.Add(item); } } Bounds(); base.Distribute(0); }
public void FastRemove(object item) { if (ContainedObjects.Contains(item)) { List <OctreeLeaf> toRemove = new List <OctreeLeaf>(); ContainedObjects.Remove(item); foreach (OctreeLeaf leaf in ChildLeaves) { leaf.FastRemove(item); if (leaf.children == null || leaf.children.Count == 0) { toRemove.Add(leaf); } } foreach (OctreeLeaf leaf in toRemove) { ChildLeaves.Remove(leaf); } } }
//private PlayerInput input = PlayerInput.instance; void Start() { trampledEnemies = this.GetSafeComponent<ContainedObjects>(); trampledEnemies.AddTagName(TagName.Enemy); }
void Start() { Physics.gravity = new Vector3(0.0f, Physics.gravity.y * 2.0f, 0.0f); // リソースロード autoLockOnIconSprite = Resources.Load<Sprite>("Sprites/AutoLockOnIcon"); manualLockOnIconSprite = Resources.Load<Sprite>("Sprites/ManualRockOnIcon"); characterController = GetComponent<CharacterController>(); cameraController = GameObject.FindGameObjectWithTag(TagName.CameraController).GetComponent<CameraController>(); //playerTrampled = GetComponentInChildren<PlayerTrampled>(); playerCamera = new PlayerCamera(cameraController, horizontalRotationSpeed, verticalRotationSpeed); animator = GetComponentInChildren<Animator>(); // アニメーションをコントロールするためのAnimatorを子から取得 meshRoot = animator.transform; // Animatorがアタッチされているのがメッシュのはずだから // ジャンプできる高さから初速を計算(√2gh) jumpPower = Mathf.Sqrt(2.0f * -Physics.gravity.y * jumpHeight); highJumpPower = Mathf.Sqrt(2.0f * -Physics.gravity.y * highJumpHeight); containedObjects = GetComponentInChildren<ContainedObjects>(); if (containedObjects == null) { Debug.Log(typeof(ContainedObjects) + " が見つかりません"); } speedID = Animator.StringToHash("Speed"); isJumpID = Animator.StringToHash("IsJump"); isGroundedID = Animator.StringToHash("IsGrounded"); isTrampledID = Animator.StringToHash("IsTrampled"); attackFlow = new PlayerAttackFlow(animator); // 初期状態へ currentState = new NormalState(this); // ロックオンアイコン用のCanvas UICanvasGenerator.FollowIconCanvasGenerate(); GameObject lockOnIconPrefab = Resources.Load<GameObject>("Prefabs/UI/LockOnIcon"); lockOnIcon = Instantiate(lockOnIconPrefab).GetSafeComponent<FollowIcon>(); lockOnIcon.Hide(); powerPointPrefab = Resources.Load<GameObject>("Prefabs/Effects/PowerPoint"); // 結界の点を生成するためのスクリプトをアタッチ powerPointCreator = gameObject.AddComponent<PowerPointCreator>(); }