/// <summary> /// 根据tag移除引力场 /// <para>string tag</para> /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int RemoveGravitationFieldByTag(ILuaState luaState) { string tag = luaState.ToString(-1); ColliderManager.GetInstance().RemoveGravitationFieldByTag(tag); return(0); }
private void Awake() { if (instance == null) { instance = this; } }
//提前判断走完后各个方向是否会造成碰撞,沿不会碰撞的方向走 public void SetPosWithJudgeCollide(Vector3 newPos) { Vector3 oldPos = objectbase.realLocalPos; Vector3 tempPos = oldPos; Vector3 targetPos = oldPos; //因为只要有一维不层叠就不会碰撞,就可以走过去 tempPos.x = newPos.x; objectbase.realLocalPos = tempPos; if (!ColliderManager.IsInCollision(objectbase)) { targetPos.x = newPos.x; } tempPos.x = oldPos.x; tempPos.y = newPos.y; objectbase.realLocalPos = tempPos; if (!ColliderManager.IsInCollision(objectbase)) { targetPos.y = newPos.y; } tempPos.y = oldPos.y; tempPos.z = newPos.z; objectbase.realLocalPos = tempPos; if (!ColliderManager.IsInCollision(objectbase)) { targetPos.z = newPos.z; } objectbase.realLocalPos = targetPos; }
// Use this for initialization void Start() { dif = GameObject.Find("DifficultyChecker").GetComponent <DifficultyCheck>(); switch (dif.difficulty) { case 0: Life = 20; break; case 1: Life = 30; timer = 4; break; case 2: Life = 50; timer = 2; break; } colliderManager = GetComponent <ColliderManager>(); target = GameObject.Find("Hero"); CanGetDamaged = true; electrified = false; Dying = false; DamageFlinch = false; Blocking = false; Walking = false; LookLeft = true; Attack = false; render = GetComponent <SpriteRenderer>(); colliderManager.ActiveCollider("StabLeft", false); }
public void Init() { // 游戏本体边界 Global.GameLBBorderPos = new Vector2(-Consts.GameWidth / 2, -Consts.GameHeight / 2); Global.GameRTBorderPos = new Vector2(Consts.GameWidth / 2, Consts.GameHeight / 2); // 弹幕边界 Global.BulletLBBorderPos = new Vector2(Global.GameLBBorderPos.x - 100, Global.GameLBBorderPos.y - 100); Global.BulletRTBorderPos = new Vector2(Global.GameRTBorderPos.x + 100, Global.GameRTBorderPos.y + 100); // 玩家坐标边界 Global.PlayerLBBorderPos = new Vector2(Global.GameLBBorderPos.x + 10, Global.GameLBBorderPos.y + 10); Global.PlayerRTBorderPos = new Vector2(Global.GameRTBorderPos.x - 10, Global.GameRTBorderPos.y - 10); InterpreterManager.GetInstance().Init(); STGStageManager.GetInstance().Init(); AnimationManager.GetInstance().Init(); BulletsManager.GetInstance().Init(); EnemyManager.GetInstance().Init(); ItemManager.GetInstance().Init(); ColliderManager.GetInstance().Init(); ExtraTaskManager.GetInstance().Init(); EffectsManager.GetInstance().Init(); STGEliminateEffectManager.GetInstance().Init(); BackgroundManager.GetInstance().Init(); #if ShowCollisionViewer CollisionViewer.Instance.Init(); #endif }
void Dispatch(bool emit) { Profiler.BeginSample("Dispatch loop"); PartEmitter.UpdateParticleBursts(); BindParticles(); if (emit) { PartEmitter.UpdatePlayEvent(); } if (!NoSimulation) { //Dispatch the update kernel. SetPariclesToKernel(ComputeShader, UpdateAllKernel); Profiler.BeginSample("Main update"); ComputeShader.Dispatch(UpdateAllKernel, DispatchCount, 1, 1); Profiler.EndSample(); ColliderManager.Dispatch(); ForceManager.Dispatch(); } Profiler.EndSample(); }
//SetParticles does a global set, so you can be sure all kernels neccesary for updating use the right memory. protected void BindParticles() { Manager.Bind(); Emitter.Bind(); ForceManager.Bind(); ColliderManager.Bind(); }
public void UpdateState2() { _time++; _curScale = MathUtil.GetEaseOutQuadInterpolation(State1EndScale, State2EndScale, _time, _duration); _detectRadius = _curScale * DefaultRadius; //CheckCollisionWithEnemyBullets(); //CheckCollisionWithEnemy(); for (int i = 0; i < BombCount; i++) { _bombsTf[i].localScale = new Vector3(_curScale, _curScale, 1); _colliderList[i].SetSize(_detectRadius, _detectRadius); } if (_time >= _duration) { // 全屏伤害 ColliderCircle collider = ColliderManager.GetInstance().CreateColliderByType(eColliderType.Circle) as ColliderCircle; collider.SetSize(500, 500); collider.SetColliderGroup(eColliderGroup.EnemyBullet | eColliderGroup.Enemy); collider.SetPosition(Global.PlayerPos.x, Global.PlayerPos.y); collider.SetEliminateType(eEliminateDef.PlayerSpellCard); collider.SetHitEnemyDamage(150); collider.SetExistDuration(1); _curState = 3; } }
void OnDisable() { if (isEnabled) { ColliderManager.UnRegist(this); } }
void OnEnable() { if (isEnabled) { ColliderManager.Regist(this); } }
void Start() { colliderBox = GetComponent <ColliderManager>(); collideres = GetComponentsInChildren <Collider2D>(); thisCollider = GetComponent <Collider2D>(); rb = GetComponent <Rigidbody2D>(); player = GetComponent <Character>(); feets = GetComponentInChildren <FeetPart>(); bodyPart = GetComponentInChildren <BodyPart>(); bodyComplete = GetComponentInChildren <BodyComplete>(); bodyComplete.gameObject.SetActive(false); Debug.Log(collideres.Length); //player.currentspeed = player.speed; for (int i = 0; i < collideres.Length; i++) { if (collideres[i].name == "Down") { collideres[i].enabled = true; } if (collideres[i].name == "StandUp") { collideres[i].enabled = false; } collideres[i].enabled = false; } }
private void Start() { colliderManager = GameManager.ActiveGameManager.ColliderManager; characterController = GetComponent <CharacterController>(); Health = GetComponent <Health>(); stateManager = GameManager.ActiveGameManager.StateManager; }
public TestCollisionSystem(DeltaTimeHandle deltaTime, ColliderManager colliderManager, EntityContext context) : base(context, batchSize: 100) { this.deltaTime = deltaTime; this.colliderManager = colliderManager; this.context = context; }
/// <summary> /// 根据tag移除碰撞器 /// <para>string tag</para> /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int RemoveObjectColliderByTag(ILuaState luaState) { string tag = luaState.ToString(-1); ColliderManager.GetInstance().RemoveColliderByTag(tag); return(0); }
public SpawnProjectilesSystem(ColliderManager colliderManager, DeltaTimeHandle deltaTime, EntityContext context) : base(context, batchSize: 100) { this.colliderManager = colliderManager; this.deltaTime = deltaTime; this.context = context; this.disabledMask = context.GetMask <DisabledTag>(); }
/// <summary> /// 根据类型创建一个引力场 /// </summary> /// <param name="luaState"></param> /// <returns></returns> public static int CreateGravitationFieldByType(ILuaState luaState) { eColliderType type = (eColliderType)luaState.ToInteger(-1); ObjectColliderBase collider = ColliderManager.GetInstance().CreateGravitationFieldByType(type); luaState.PushLightUserData(collider); return(1); }
private void Start() { feets = GetComponentInParent <FeetPart>(); anim = GetComponent <AnimationControllerCustom>(); render = GetComponent <SpriteRenderer>(); collideras = GetComponentInParent <ColliderManager>(); gunActive = true; }
protected ColliderBase(ColliderManager colliderManager) { Components.Add(SceneNode = new SceneNode()); _colliderManager = colliderManager; _colliderManager.Add(this); LocalCenter = Vector2.Zero; }
void Start() { mCharacter = GameObject.FindGameObjectWithTag("MC").GetComponent <CharacterBehaviour>(); mCollider = transform.GetComponent <ColliderManager>(); xTmp = transform.position.x; yTmp = transform.position.y; m_dir = Vector3.up; InvokeRepeating("Start1", 0f, 5f); }
[Range(20f, 200f)][SerializeField] float roundTime = 60f; //timerFadeout void Start() { m_ObjectiveTest = GetComponent <ObjectiveTest>(); m_ColliderManager = GetComponent <ColliderManager>(); roundNum = 0; argumentMeter.maxValue = roundTime; hasRoundStarted = false; gameOverUI.SetActive(false); }
void Start() { states = GetComponent <PlayerStates>(); bc = GetComponent <BoxCollider2D>(); colliderManager = GetComponent <ColliderManager>(); spaceChecker = GetComponent <SpaceChecker>(); movement = GetComponent <Movement>(); smallerDimension = Mathf.Min(bc.size.x, bc.size.y); biggerDimension = Mathf.Max(bc.size.x, bc.size.y); }
public Game() { /// 게임에 쓰일 기능들 초기화 userMediator = new UserSessionMediator(); gameObjectManager = new GameObjectManager(this); timer = new GameTimer(); colliderManager = new ColliderManager(); scoreBoard = new Scoreboard(this); scoreBoard.SetCallback(GameWinPredicate, OnGameWinnerDecision); }
[Range(1f, 200f)][SerializeField] float roundTime = 60f; //timerFadeout void Start() { m_ObjectiveTest = GetComponent <ObjectiveTest>(); m_ColliderManager = GetComponent <ColliderManager>(); m_BasicSpawnManager = GetComponent <BasicSpawnManager>(); // m_JoystickManager = wheelSelector.GetComponent<JoystickManager>(); // roundNum = 0; argumentMeter.maxValue = roundTime; hasRoundStarted = false; gameOverUI.SetActive(false); }
/// <summary> /// 创建一个销毁敌机子弹以及敌机的ObjectCollider /// </summary> private void CreateEliminateEnemyCollider(Vector2 pos) { // 清除子弹用的collider ColliderCircle collider = ColliderManager.GetInstance().CreateColliderByType(eColliderType.Circle) as ColliderCircle; collider.SetPosition(pos); collider.SetSize(0, 0); collider.SetEliminateType(eEliminateDef.SpellCardFinish); collider.SetColliderGroup(eColliderGroup.EnemyBullet | eColliderGroup.Enemy); collider.ScaleToSize(400, 400, 30); collider.SetExistDuration(30); }
// enum FurnitureTypes // { // AR_Tullsta // } private void Awake() { m_ColliderManager = gameObject.GetComponent <ColliderManager>(); furnitureTypes.Add(0, "odwar"); furnitureTypes.Add(1, "tullsta"); furnitureTypes.Add(2, "brimnes"); furnitureTypes.Add(3, "ektorp"); comparisonTypes.Add(0, "equals"); comparisonTypes.Add(1, "is less than"); comparisonTypes.Add(2, "is greater than"); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } quad = new Quadtree(0, new Rectangle(transform.position.x - width / 2, transform.position.y - height / 2, width, height)); }
// Use this for initialization void Start() { notifications.AddListener(this, "onBoardMove"); colliders = gameObject.GetComponent <ColliderManager>(); collidersCache = colliders.cachePos; thisPosition = gameObject.transform.position; Gds = (2 * ((tileSize * gridSize) + (tileSize / 2))); direction = 1; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); onPlayStart(); }
private void RenderCollider() { Color col = new Color(255f / 255, 50f / 255, 255f / 255); int count; List <ObjectColliderBase> list = ColliderManager.GetInstance().GetColliderList(out count); //int count = list.Count; foreach (var collider in list) { if (collider != null) { RenderCollisionGraphic(collider.GetCollisionDetectParas(), col); } } }
public bool IsInAttackRange(ActorBase enemy, DBSkillDamageConf damage) { //伤害中心 Vector3 damageCenter = Vector3.zero; Vector3 t = damage.damageCenterPos; if (damage.damageCenterType == EmDamageCenterType.Attacker) { if (!actor.objectbase.isFacingRight) { t.x = -t.x; } damageCenter = actor.objectbase.realPos + t; } else if (damage.damageCenterType == EmDamageCenterType.Target) { damageCenter = enemy.objectbase.realPos + damage.damageCenterPos; } else if (damage.damageCenterType == EmDamageCenterType.AttackObject) { damageCenter = eo.effectObject.realPos + damage.damageCenterPos; } else { Debug.LogError("damage.damageCenterType is none"); } //球形区域不用判断 if (damage.damageArenaType == EmDamageArenaType.FrontArena) { if (!actor.objectbase.IsInFrontOfMe(enemy.objectbase.realLocalPos)) { return(false); } } //伤害区域这样处理是以伤害中心为球心的球 //todo,中心为Target和AttackObject作为球体处理,Attacker才具有多样化,因为attacker可以获取到朝向。其他的朝向都是未知/变动的。 //float dist = (damageCenter - enemy.objectbase.realLocalPos).sqrMagnitude; //Debug.Log(dist); //if(dist > damage.damageDistance * damage.damageDistance) // return false; //伤害区域这样处理是以伤害中心为中心的立方体 return(ColliderManager.IsCollision(damageCenter, new Vector3(damage.damageArenaRadius, damage.damageArenaRadius, damage.damageArenaRadius), enemy.objectbase.realLocalPos + new Vector3(0, enemy.actorConf.size.y * 0.5f, 0), enemy.actorConf.size)); //return true; }
private void Start() { player = GameManager.ActiveGameManager.Player; characterController = GetComponent <CharacterController>(); layerMask = LayerMask.GetMask("DrawCollider"); lineRenderer = GetComponent <LineRenderer>(); smoothedPoints = new Vector3[maxSmoothedPoints]; drawPoints = new Vector3[maxDrawPoints]; timeManager = GameManager.ActiveGameManager.TimeManager; stateManager = GetComponent <StateManager>(); inputManager = GameManager.ActiveGameManager.InputManager; colliderManager = GameManager.ActiveGameManager.ColliderManager; pathAboveGround = Vector3.up * 0.08f; materialManager = GameManager.ActiveGameManager.MaterialManager; powerManager = GameManager.ActiveGameManager.PowerManager; Deactivate(); }
public void setRunHurtBox(ColliderManager.frames val) { hurtboxmanager.setCollider (ColliderManager.types.run, val); }
public void setIdleHurtBox(ColliderManager.frames val) { hurtboxmanager.setCollider (ColliderManager.types.idle, val); }
public void setNeutralHeavyHurtBox(ColliderManager.frames val) { hurtboxmanager.setCollider (ColliderManager.types.neutral_heavy, val); }
public void setNeutralLightHitBox(ColliderManager.frames val) { hitboxmanager.setCollider (ColliderManager.types.neutral_light, val); }