public void OnContactPlanet(GamePlanet gp) { Debug.Log("OnContactPlanet"); m_State = BeanState.Stand; this.transform.parent = gp.transform; }
public void ProcessOceanRewards(List <BaseAgent> agents, List <Weight> weights, GamePlanet planet) { foreach (var agent in agents) { float openReward = 0.1f; float concientiousReward = 9 - (System.Math.Abs(planet.AngularVelocity.x) + System.Math.Abs(planet.AngularVelocity.y) + System.Math.Abs(planet.AngularVelocity.z)); float extrovertReward = 0.1f; float neuroticReward = 0; var agentAngle = Vector3.Angle(agent.transform.position - planet.transform.position, Vector3.up); neuroticReward = 1 - agentAngle / 45; foreach (var otherAgent in agents) { if (!agent.Equals(otherAgent) && otherAgent.IsConsuming) { openReward = -1; extrovertReward = 1; } } if (agent.IsConsuming) { openReward = 1; } UpdateStatsRecorder(agent.name + " Open", openReward); UpdateStatsRecorder(agent.name + " Concientious", concientiousReward); UpdateStatsRecorder(agent.name + " Extrovert", extrovertReward); UpdateStatsRecorder(agent.name + " Neurotic", neuroticReward); UpdateStatsRecorder(agent.name + " Open", openReward); } }
void OnTriggerEnter2D(Collider2D other) { Bean pBean = other.gameObject.GetComponent <Bean>(); if (pBean != null) { m_SelfBean.OnContactBean(pBean); return; } GamePlanet pPlanet = other.gameObject.GetComponent <GamePlanet>(); if (pPlanet != null) { m_SelfBean.OnContactPlanet(pPlanet); return; } }
public void Enter() { GameObject pPlanetObjIns = Resources.Load(ResPath) as GameObject; if (pPlanetObjIns == null) { Debug.LogError("Not Find Planet Res"); return; } GameObject MapObj = GameObject.Instantiate(pPlanetObjIns); m_Emit = MapObj.GetComponentInChildren <TestBeanEmitter>(); m_Plant = MapObj.GetComponentInChildren <GamePlanet>(); m_Plant.ChangeState(new PlanetReady(m_Plant)); }
public void Enter() { GameObject MapObj = m_Game.MapObj; if (MapObj == null) { Debug.LogError("Not Find MapObj"); return; } MapObj.SetActive(true); m_Emit = MapObj.GetComponentInChildren <TestBeanEmitter>(); m_Plant = MapObj.GetComponentInChildren <GamePlanet>(); m_Plant.ChangeState(new PlanetReady(m_Plant)); }