예제 #1
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Polyline polyline = entity as Polyline;

            if (polyline == null)
            {
                return(false);
            }

            Bounding pkBounding = pkbox.reservedBounding;

            for (int i = 1; i < polyline.NumberOfVertices; ++i)
            {
                Line2 line = new Line2(
                    polyline.GetPointAt(i - 1),
                    polyline.GetPointAt(i));

                if (LineHitter.BoundingIntersectWithLine(pkBounding, line))
                {
                    return(true);
                }
            }

            return(false);
        }
 public LargeAI_Control(int?p_num, AgentManager manager) : base(p_num)
 {
     movement_timer = new global::Timer(1, true);
     m_Path_Manager = GameObject.FindGameObjectWithTag(GLOBAL_VALUES.TAG_AI_MANAGER).GetComponent <Pathing_Manager>();
     m_Manager      = manager;
     m_PickupBox    = m_Manager.Get_Object().GetComponentInChildren <PickupBox>();
 }
예제 #3
0
 // methods for the freezer effect event
 public static void AddInvokerFreezerEffect(PickupBox script)
 {
     invokerFreezerEffect = script;
     if (listenerFreezerEffect != null)
     {
         invokerFreezerEffect.AddFreezerEffectListener(listenerFreezerEffect);
     }
 }
예제 #4
0
    //methods for speed up effect event
    public static void AddInvokerSpeedupEffect(PickupBox script)
    {
        invokerSpeedupEffect = script;

        foreach (UnityAction <float, float> listener in listenerSpeedupEffect)
        {
            invokerSpeedupEffect.AddSpeedupEffectListener(listener);
        }
    }
예제 #5
0
    public bool Pickup()
    {
        GameObject pickup_box = m_manager.Get_Object().transform.Find("Pickup_Box").gameObject;
        PickupBox  box        = pickup_box.GetComponentInChildren <PickupBox>();
        GameObject closest    = box.Get_Closest_Object();

        if ((!m_manager.isCarrying()) && (!m_input.Get_B_Held()) && (closest != null) && (closest.GetComponent <Item>().GetItemState() != ItemState.carried))
        {
            m_manager.Get_Animator().SetTrigger(GLOBAL_VALUES.ANIM_TRIGGER_PICKUP);

            //removing collisions
            foreach (Collider c in closest.GetComponents <Collider>())
            {
                c.isTrigger = true;
            }
            foreach (Rigidbody rb in closest.GetComponents <Rigidbody>())
            {
                rb.detectCollisions = true;
                rb.isKinematic      = true;
            }

            //Find Carry Point
            GameObject carry_point = null;
            if (m_manager.Get_Object().CompareTag(GLOBAL_VALUES.TAG_PLAYER))
            {
                GameObject findObj = m_manager.Get_Object().transform.Find("jntTorsoLowerMain").gameObject;
                findObj     = findObj.transform.Find("jntTorsoUpper").gameObject;
                findObj     = findObj.transform.Find("jntHand_R").gameObject;
                findObj     = findObj.transform.Find("Carry_Point").gameObject;
                carry_point = findObj;
            }
            else
            {
                carry_point = m_manager.Get_Object().transform.Find("Carry_Point").gameObject;
            }

            closest.transform.parent     = carry_point.transform; //set pickup a child of player
            closest.transform.position   = carry_point.transform.position;
            closest.transform.rotation   = carry_point.transform.rotation;
            closest.transform.localScale = new Vector3(1, 1, 1);
            closest.GetComponent <Item>().SetState(ItemState.carried);
            closest.GetComponent <Item>().impactFirstHit = true;
            closest.transform.localScale = closest.GetComponent <Item>().scale;
            source.PlayOneShot(pickup);
            Animator a = closest.GetComponent <Animator>();
            if (a != null)
            {
                a.Play("Idle", -1, 0);
                a.StopPlayback();
            }
            //FindColourEffect("p/d", m_manager.Get_Color());
            m_manager.SetItemCarried(closest);
            return(true);
        }
        return(false);
    }
예제 #6
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Circle circle = entity as Circle;

            if (circle == null)
            {
                return(false);
            }

            return(MathUtils.BoundingCross(pkbox.reservedBounding, circle));
        }
예제 #7
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Xline xline = entity as Xline;

            if (xline == null)
            {
                return(false);
            }

            Bounding bounding = pkbox.reservedBounding;

            return(BoundingIntersectWithXline(bounding, xline));
        }
예제 #8
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Arc arc = entity as Arc;

            if (arc == null)
            {
                return(false);
            }

            ArcRS arcRS = new ArcRS();

            return(arcRS.Cross(pkbox.reservedBounding, arc));
        }
예제 #9
0
 public SecurityAI_Control(int?p_num, AgentManager manager) : base(p_num)
 {
     movement_timer = new global::Timer(1, true);
     heal_timer     = new Timer(GLOBAL_VALUES.SECURITY_HEAL_DELAY, true);
     m_Path_Manager = GameObject.FindGameObjectWithTag(GLOBAL_VALUES.TAG_AI_MANAGER).GetComponent <Pathing_Manager>();
     m_Manager      = manager;
     m_ItemVision   = m_Manager.Get_Object().transform.Find("Item_Vision").GetComponent <SecurityItemVision>();
     m_PickupBox    = m_Manager.Get_Object().GetComponentInChildren <PickupBox>();
     m_State        = Security_State.Patrol;
     m_Alert_Object = m_Manager.Get_Object().transform.Find("Security_Alert").gameObject;
     m_ChaseEffect  = m_Manager.Get_Object().transform.Find("Angry").gameObject.GetComponent <ParticleSystem>();
     m_Alert_Object.SetActive(false);
 }
예제 #10
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Ray ray = entity as Ray;

            if (ray == null)
            {
                return(false);
            }

            Bounding bounding = pkbox.reservedBounding;

            return(BoundingIntersectWithRay(bounding, ray));
        }
예제 #11
0
        public PointerContoller(IDrawing drawing)
        {
            _drawing = drawing;

            _pickupBox      = new PickupBox(_drawing);
            _pickupBox.side = 20;

            _cursor        = new Cursor(_drawing);
            _cursor.Length = 60;

            _snapNodesMgr = new SnapNodesController(_drawing);
            _anchorMgr    = new GripPointsController(_drawing);
        }
예제 #12
0
    public void Reset()
    {
        m_StatCollector.Reset();
        Zero_Score();
        m_Actions.Drop(false);
        m_Instance.transform.position = m_SpawnPoint.GetComponent <SpawnZone>().Get_Unique_Random_Spawn_Point();
        m_Instance.transform.rotation = m_SpawnPoint.transform.rotation;
        GameObject pickup_box = m_Instance.transform.Find("Pickup_Box").gameObject;
        PickupBox  box        = pickup_box.GetComponent <PickupBox>();

        m_Body.velocity = Vector3.zero;
        box.items_in_range.Clear();
        m_BadgeAllocation = "WINDOW_SHOPPER_" + m_Player_Number;
    }
예제 #13
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Ellipse ellipse = entity as Ellipse;

            if (ellipse == null)
            {
                return(false);
            }

            var inter = IntersectionUtility.IntersectEllipseRectangle(ellipse.center, ellipse.RadiusX, ellipse.RadiusY,
                                                                      new CADPoint(pkbox.reservedBounding.left, pkbox.reservedBounding.bottom),
                                                                      new CADPoint(pkbox.reservedBounding.right, pkbox.reservedBounding.top));

            return(inter.Status == IntersectionUtility.Intersection.IntStatus.Intersection);
        }
예제 #14
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Line line = entity as Line;

            if (line == null)
            {
                return(false);
            }

            Bounding pkBounding = pkbox.reservedBounding;

            return(LineHitter.BoundingIntersectWithLine(
                       pkBounding,
                       new Line2(line.startPoint, line.endPoint)));
        }
예제 #15
0
 private void OnTriggerEnter(Collider other)
 {
     if (currentPowerup == null)
     {
         if (pickup = other.gameObject.GetComponent <PickupBox>())
         {
             Debug.Log("GotPowerup");
             pickup.Despawn();
             RaceManager.Instance.NewPowerup(this);
         }
     }
     if (other.gameObject.CompareTag("ButtShield") &&
         other.gameObject != gameObject.transform.GetChild(1).transform.GetChild(0).gameObject&&
         other.gameObject != gameObject.transform.GetChild(1).transform.GetChild(1).gameObject)
     {
         GoFlying();
     }
 }
예제 #16
0
    public bool Pickup(PickupBox pickupBox)
    {
        // did the pickup actually cause its effect
        bool effectActivated = false;

        switch (pickupBox.type)
        {
        case PickupType.HEALTH:
            //TODO: allow for variable increase in health?
            if (health != null && health.IncreaseHealth(1))
            {
                //Debug.Log("Destroying pickup");
                pickupBox.DestroyPickup();
                effectActivated = true;
            }
            break;

        case PickupType.ARMOR:
            //TODO: allow for variable increase in armor?
            if (health != null && health.IncreaseArmor(3))
            {
                pickupBox.DestroyPickup();
                effectActivated = true;
            }
            break;

        case PickupType.POISON:
            if (health != null)
            {
                health.TakeDamage(1);
                pickupBox.DestroyPickup();
            }
            break;

        case PickupType.SPEED:
            if (playerMovement != null && (activePowerups == null || !activePowerups.Contains(PickupType.SPEED)))
            {
                previousJumpSpeed = playerMovement.jumpSpeed;
                previousMoveSpeed = playerMovement.moveSpeed;
                health.IncreaseArmor(1);
                playerMovement.jumpSpeed *= jumpSpeedMultiplier;
                playerMovement.moveSpeed *= moveSpeedMultiplier;
                activePowerups.Add(PickupType.SPEED);
                pickupBox.DestroyPickup();
                effectActivated = true;
            }
            break;

        case PickupType.SUPER_FASTFALL:
            if (playerInput != null && (activePowerups == null || !activePowerups.Contains(PickupType.SUPER_FASTFALL)))
            {
                playerInput.superFastfallActive = true;
                health.IncreaseArmor(1);
                activePowerups.Add(PickupType.SUPER_FASTFALL);
                pickupBox.DestroyPickup();
                effectActivated = true;
            }
            break;

        case PickupType.INVINCIBILITY:
            if (messenger != null)
            {
                messenger.Invoke(Message.INVINCIBILITY_PICKUP, null);
                pickupBox.DestroyPickup();
                effectActivated = true;
            }
            break;

        case PickupType.GUN:
            if (playerInput != null && (activePowerups == null || !activePowerups.Contains(PickupType.GUN)))
            {
                playerInput.gunActive = true;
                health.IncreaseArmor(1);
                pickupBox.DestroyPickup();
                activePowerups.Add(PickupType.GUN);
                effectActivated = true;
            }
            break;

        case PickupType.HELMET:
            if (bodyHurtboxCollider != null && (activePowerups == null || !activePowerups.Contains(PickupType.HELMET)))
            {
                bodyHurtboxCollider.size     = new Vector2(bodyHurtboxCollider.size.x, bodyHurtboxCollider.size.y - helmetHeight);
                bodyHurtboxCollider.offset   = new Vector2(bodyHurtboxCollider.offset.x, bodyHurtboxCollider.offset.y - (helmetHeight / 2));
                helmetSpriteRenderer.enabled = true;
                activePowerups.Add(PickupType.HELMET);
                pickupBox.DestroyPickup();
                effectActivated = true;
            }
            break;
        }
        return(effectActivated);
    }
예제 #17
0
파일: Robot.cs 프로젝트: atymisk/Boulder
    void Start()
    {
        currentState = CharacterState.Idle;
        anim = gameObject.GetComponent<Animator>();
        rigidbodyTwoD = this.gameObject.GetComponent<Rigidbody2D>();
        hurtBox = this.transform.FindChild ("HurtBox").GetComponent<RobotHurtBox>();
        pickupBox = this.transform.FindChild("PickupBox").GetComponent<PickupBox>();
        headHitBox = this.transform.FindChild("HeadHitBox").GetComponent<BoxCollider2D>();
        shieldParticle = this.transform.FindChild ("Pelvis").FindChild ("Shield").gameObject;
        if(toturial == 0)
            gm = (GameManager)GameObject.Find("GameManager").GetComponent<GameManager>();

        //healthNum = charUI.transform.Find ("healthText").GetComponent<Text> ();
        setCharUI();

        InitializeParts();
        this.transform.FindChild ("Pelvis").FindChild ("ThrusterEffects").gameObject.SetActive(false);
        this.transform.FindChild ("Pelvis").FindChild ("Shield").gameObject.SetActive(false);

        if (this.transform.right.x < 0)
        {
            isFacingLeft = true;
        }
        else
        {
            isFacingLeft = false;
        }
        InvokeRepeating ("updateNoParts", 0, 1f);
    }
예제 #18
0
 public void SetPickupBox(PickupBox pickupBox)
 {
     this.pickupBox             = pickupBox;
     pickupBox.transform.parent = rotator.transform;
 }
예제 #19
0
 internal abstract bool Hit(PickupBox pkbox, Entity entity);