void Start() { limb = GetComponentInParent <Limb>(); controller = GetComponentInParent <StickmanController>(); ig = GetComponentInParent <IgnoreCollision>(); var circleColl = gameObject.AddComponent <CircleCollider2D>(); circleColl.radius = .05f; coll = circleColl; if (ig) { ig.IgnoreCollider(coll); } rb = GetComponent <Rigidbody2D>(); parent = transform; while (parent.parent) { parent = parent.parent; } mask = ~LayerMask.GetMask("Moveable"); joint = gameObject.AddComponent <FixedJoint2D>(); joint.enabled = false; }
private void Awake() { stickmanController = transform.parent.GetComponent <StickmanController>(); if (!stickmanController) { Destroy(this); } }
public void Update() { if (target) { if (!target.IsAlive()) { target = null; animator.SetBool("walk", false); animator.SetBool("attack", false); return; } var direction = target.transform.position - transform.position; if (Mathf.Abs(direction.magnitude) > 5) { controller.hip.AddForce(controller.moveSpeed * direction * Vector2.right); animator.SetBool("walk", true); walking = true; animator.SetBool("attack", false); } else if (walking) { walking = false; animator.SetBool("walk", false); } else { animator.SetBool("attack", true); } } foreach (var stickman in PlayerStickman.stickman) { if (stickman.IsAlive()) { target = stickman.getController(); } } }
public StickmanLaunchState(StickmanController contoller) : base(contoller) { }
public StickmanAi(StickmanController controller) { this.controller = controller; animator = controller.animator; }
public PlayerStickman(StickmanController controller) { stickman.Add(this); this.controller = controller; animator = controller.animator; }
private void Start() { controller = GetComponent <StickmanController>(); }
// Start is called before the first frame update void Start() { controller = GetComponentInParent <StickmanController>(); }
public StickmanSwingState(StickmanController controller) : base(controller) { }
public StickmanRotationState(StickmanController controller) : base(controller) { }
public void SetController(StickmanController controller) { Controller = controller; }
public StickmanState(StickmanController controller) { Controller = controller; }
public NoneState(StickmanController controller) : base(controller) { }