Inheritance: MonoBehaviour
Ejemplo n.º 1
0
            private void SetDayBoxSize()
            {
                int     bottom        = Height;
                HitArea dayTopHitArea = HitTest(1, _dayTop).HitArea;
                HitArea bottomHitArea = HitTest(1, bottom).HitArea;

                if (dayTopHitArea != HitArea.Nowhere)
                {
                    while (dayTopHitArea != HitArea.Date && dayTopHitArea != HitArea.PrevMonthDate)
                    {
                        _dayTop++;
                    }
                }

                if (bottomHitArea != HitArea.Nowhere)
                {
                    while (bottomHitArea != HitArea.Date && bottomHitArea != HitArea.NextMonthDate)
                    {
                        bottom--;
                    }
                }
                _dayBox = new Rectangle {
                    Size = new Size((Width / 7), (bottom - _dayTop) / 6)
                };
            }
Ejemplo n.º 2
0
    void Awake()
    {
        Rig = GetComponent <Rigidbody2D>();

        SpeedMultiplier = 1.0f;
        RotGyesu        = 1.0f;
        SizeTimer       = 0.0f;
        if (Collider != null)
        {
            BaseRad = Collider.radius;
        }
        BodyScale = Vector3.one;

        IsBarVisible = false;
        if (HP_Bar != null)
        {
            HP_Bar.fillAmount = 1.0f;
            Canvas.SetActive(false);
            HitArea = transform.GetChild(1).GetComponent <HitArea>();
        }

        TargetPosition = Vector3.zero;
        IsInvincible   = false;

        IsReflected = false;
        CurveTime   = 0.0f;
        IsDot       = false;
    }
Ejemplo n.º 3
0
 public bool ProtectsArea(HitArea area)
 {
     if (Object.op_Equality((Object)this.armorProperties, (Object)null))
     {
         return(false);
     }
     return(this.armorProperties.Contains(area));
 }
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "Player Hit Area")
     {
         HitArea area = coll.gameObject.GetComponent <HitArea>();
         actionCtrl.TakeHit(coll.gameObject, area.damage, area.stagger, area.knockback);
     }
 }
Ejemplo n.º 5
0
 public bool ProtectsArea(HitArea area)
 {
     if (armorProperties == null)
     {
         return(false);
     }
     return(armorProperties.Contains(area));
 }
Ejemplo n.º 6
0
    public void ScaleDamage(HitInfo info)
    {
        HitArea boneArea = info.boneArea;

        if (boneArea != (HitArea)(-1) && boneArea != 0)
        {
            info.damageTypes.ScaleAll(GetMultiplier(boneArea));
        }
    }
    public void ScaleDamage(HitInfo info)
    {
        HitArea hitArea = info.boneArea;

        if (hitArea == (HitArea.Head | HitArea.Chest | HitArea.Stomach | HitArea.Arm | HitArea.Hand | HitArea.Leg | HitArea.Foot) || (int)hitArea == 0)
        {
            return;
        }
        info.damageTypes.ScaleAll(this.GetMultiplier(hitArea));
    }
Ejemplo n.º 8
0
 public bool HitByPoint(PointF P, bool Collapsed)
 {
     if (Collapsed)
     {
         return(CollapsedHitArea.IsVisible(P));
     }
     else
     {
         return(HitArea.IsVisible(P));
     }
 }
Ejemplo n.º 9
0
        public Ship() : base(0x20000000)
        {
            //model = Program.Instance.Content.Load<Model>("block");
            model = Program.Instance.Content.Load <Model>("paper");

            // 初期状態は非表示&動作無し
            // 各シーンで必要性に応じてActivateまたはDeactivateを行う
            Deactivate();

            HitArea.AddHitArea(new ShipHitArea(this));
        }
Ejemplo n.º 10
0
 public bool HitByRect(RectangleF R, bool Collapsed)
 {
     if (Collapsed)
     {
         return(CollapsedHitArea.IsVisible(R));
     }
     else
     {
         return(HitArea.IsVisible(R));
     }
 }
Ejemplo n.º 11
0
    private void InitComponents()
    {
        InitRigidbody2D();
        spriteRender = GetComponent <SpriteRenderer>();

        player = FindObjectOfType <Player>();

        attackRange = GetComponentInChildren <AttackRange>();
        hitArea     = GetComponentInChildren <HitArea>();

        fallingCondition = GetComponentInChildren <FallingCondition>();
    }
Ejemplo n.º 12
0
 public static string Format(HitArea area)
 {
     if ((int)area == 0)
     {
         return("None");
     }
     if (area == (HitArea.Head | HitArea.Chest | HitArea.Stomach | HitArea.Arm | HitArea.Hand | HitArea.Leg | HitArea.Foot))
     {
         return("Generic");
     }
     return(area.ToString());
 }
Ejemplo n.º 13
0
 public static string Format(HitArea area)
 {
     if (area == (HitArea)0)
     {
         return("None");
     }
     if (area == (HitArea) - 1)
     {
         return("Generic");
     }
     return(area.ToString());
 }
 public void Add(List <Item> items, HitArea area = (HitArea) - 1)
 {
     for (int index = 0; index < items.Count; ++index)
     {
         Item            obj       = items[index];
         ItemModWearable component = (ItemModWearable)((Component)obj.info).GetComponent <ItemModWearable>();
         if (!Object.op_Equality((Object)component, (Object)null) && component.ProtectsArea(area))
         {
             component.CollectProtection(obj, this);
         }
     }
 }
Ejemplo n.º 15
0
            /// <summary>
            ///  Determines whether a given HitArea should have a corresponding valid DateTime
            /// </summary>
            internal static bool HitAreaHasValidDateTime(HitArea hitArea)
            {
                // ComCtl does not provide a valid date for DayOfWeek.
                switch (hitArea)
                {
                case HitArea.Date:
                case HitArea.WeekNumbers:
                    return(true);
                }

                return(false);
            }
Ejemplo n.º 16
0
    WaitForSeconds revealDuration; // Duration of Reveal-State
    #endregion

    void Start()
    {
        timerSystem = GameObject.Find("System").transform.Find("Timer System").GetComponent <TimerSystem>();
        hitArea     = GameObject.Find("TimerBar").transform.Find("Hit Area").GetComponent <HitArea>();

        setGUI();

        setWaits();

        minValue              = 0; maxValue = 1000;
        needDelay             = true;
        optimizer_hideHitArea = true; optimizer_stopTimer = true; optimizer_fixDir = true;
    }
Ejemplo n.º 17
0
 public override void OnMessage(object sender, Message.MessageType msg, object[] args)
 {
     if (msg == Message.MessageType.Collide)
     {
         Message.EnqueueMessage(new Message(this, this, Message.MessageType.Kill, null));
     }
     else if (msg == Message.MessageType.Kill)
     {
         HitArea.RemoveHitArea(this);
         RemoveObject(this);
     }
     base.OnMessage(sender, msg, args);
 }
Ejemplo n.º 18
0
    // Start is called before the first frame update
    void Start()
    {
        timerSystem   = GameObject.Find("System").transform.Find("Timer System").GetComponent <TimerSystem>();
        gradeSystem   = GameObject.Find("System").transform.Find("Grade System").GetComponent <GradeSystem>();
        patternSystem = GameObject.Find("System").transform.Find("Pattern System").GetComponent <PatternSystem>();

        milkTimer = GameObject.Find("Timer GUI").GetComponent <TimerGUI>();
        hitArea   = GameObject.Find("TimerBar").transform.Find("Hit Area").GetComponent <HitArea>();

        RestartDelay = new WaitForSeconds(1f);

        Play_Milk();
    }
Ejemplo n.º 19
0
    public static string Format(HitArea area)
    {
        switch (area)
        {
        case (HitArea)0:
            return("None");

        case (HitArea)(-1):
            return("Generic");

        default:
            return(area.ToString());
        }
    }
    //Function : GetComponent Function
    // Method : mainly use for GetComponentFunction;
    void GetComponentFunction()
    {
        if (_PlayerCtrl == null)
        {
            _PlayerCtrl = GetComponentInParent <MainChracterCtrl>();
        }
        if (_EnemyCtrl == null)
        {
            _EnemyCtrl = GetComponentInParent <EnemyCtrl>();
        }

        if (_instance == null)
        {
            _instance = this;
        }
    }
 public float GetMultiplier(HitArea area)
 {
     for (int i = 0; i < (int)this.bones.Length; i++)
     {
         DamageProperties.HitAreaProperty hitAreaProperty = this.bones[i];
         if (hitAreaProperty.area == area)
         {
             return(hitAreaProperty.damage);
         }
     }
     if (!this.fallback)
     {
         return(1f);
     }
     return(this.fallback.GetMultiplier(area));
 }
Ejemplo n.º 22
0
        public Bullet(int type) : base(BulletPriority + type)
        {
            id = gid++;

            if (bulletDrawer == null)
            {
                bulletDrawer = new Drawer();
                AddObject(bulletDrawer);
            }

            //GameObject.AddObject(this);
            Enabled = true;
            Visible = true;

            HitArea.AddHitArea(new BulletHitArea(this));
        }
Ejemplo n.º 23
0
 public float GetMultiplier(HitArea area)
 {
     for (int i = 0; i < bones.Length; i++)
     {
         HitAreaProperty hitAreaProperty = bones[i];
         if (hitAreaProperty.area == area)
         {
             return(hitAreaProperty.damage);
         }
     }
     if (!fallback)
     {
         return(1f);
     }
     return(fallback.GetMultiplier(area));
 }
Ejemplo n.º 24
0
 public float GetMultiplier(HitArea area)
 {
     for (int index = 0; index < this.bones.Length; ++index)
     {
         DamageProperties.HitAreaProperty bone = this.bones[index];
         if (bone.area == area)
         {
             return(bone.damage);
         }
     }
     if (!Object.op_Implicit((Object)this.fallback))
     {
         return(1f);
     }
     return(this.fallback.GetMultiplier(area));
 }
Ejemplo n.º 25
0
        internal static Projectile GetAvailableProjectile(
            List <Projectile> gameObjects,
            CreateProjectile createProjectile,
            Unit.OnHit onHit,
            IAm iAm,
            ref int?projectileIndex
            )
        {
            Projectile go = null;
            int        i  = 0;

            foreach (Projectile obj in gameObjects)
            {
                if (obj.Available == true)
                {
                    go = obj;
                    projectileIndex = i;
                    //Debug.Log(obj.gameObject.activeSelf + " :" + DateTime.Now);
                    break;
                }
                i++;
            }

            if (go == null)
            {
                HitArea arrowHitArea = null;
                go = createProjectile(go);
                foreach (Transform hA in go.transform)
                {
                    arrowHitArea = hA.GetComponent <HitArea>();
                    if (arrowHitArea != null)
                    {
                        break;
                    }
                }
                if (arrowHitArea != null)
                {
                    arrowHitArea.Init(onHit, iAm.ToString(), isProjectile: true, projectile: go);
                }

                return(go);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 26
0
    public static HitArea toHitArea(Bounds bounds)
    {
        HitArea area = new HitArea();

        Vector3 min = bounds.min;
        Vector3 max = bounds.max;

        area.left   = min.x;
        area.bottom = min.y;
        area.back   = min.z;

        area.right = max.x;
        area.top   = max.y;
        area.front = max.z;

        return(area);
    }
Ejemplo n.º 27
0
    //Move
    void UpdateInput()
    {
        if (InputManager.Instance.IsMouseDown())
        {
            Vector3 mousePosition = InputManager.Instance.GetCursorPosition();

            Ray        ray = Camera.main.ScreenPointToRay(mousePosition);
            RaycastHit hit;

            LayerMask layerMask = (1 << LayerMask.NameToLayer("Ground")) | (1 << LayerMask.NameToLayer("Character"));


            if (Physics.Raycast(ray, out hit, 100.0f, layerMask))
            {
                if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Ground"))
                {
                    _targetPosition = hit.point;
                    _targetObj      = null;
                    _isSetPosition  = true;
                    //_stateList[_stateType].UpdateInput();
                }

                else if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Character"))
                {
                    HitArea   hitArea   = hit.collider.gameObject.GetComponent <HitArea>();
                    Character character = hitArea.GetCharacter();

                    switch (character.GetCharacterType())
                    {
                    case eCharacterType.MONSTER:
                        //적
                        Debug.Log("MONSTER");
                        //_targetPosition = hit.collider.gameObject.transform.position;
                        _targetObj = hit.collider.gameObject;
                        ChangeState(eState.CHASE);
                        break;
                    }
                }
            }
        }

        if (InputManager.Instance.IsAttackButtonDown())
        {
            ChangeState(eState.ATTACK);
        }
    }
Ejemplo n.º 28
0
    public void ScaleDamage(HitInfo info)
    {
        HitArea boneArea = info.boneArea;

        switch (boneArea)
        {
        case (HitArea) - 1:
            break;

        case (HitArea)0:
            break;

        default:
            info.damageTypes.ScaleAll(this.GetMultiplier(boneArea));
            break;
        }
    }
Ejemplo n.º 29
0
    void UpdateInput()
    {
        if (InputManager.Instance.IsMouseDown())
        {
            Vector3 mousePosition = InputManager.Instance.GetCursorPosition();

            Ray        ray = Camera.main.ScreenPointToRay(mousePosition);
            RaycastHit hitInfo;
            if (Physics.Raycast(ray, out hitInfo, 100.0f, 1 << LayerMask.NameToLayer("Ground")
                                | 1 << LayerMask.NameToLayer("HitArea")))
            {
                if (LayerMask.NameToLayer("Ground") == hitInfo.collider.gameObject.layer)
                {
                    _targetPosition    = hitInfo.point;
                    _targetObject      = null;
                    _isSetMovePosition = true;
                    //_stateMap[_stateType].UpdateInput();
                }

                if (LayerMask.NameToLayer("HitArea") == hitInfo.collider.gameObject.layer)
                {
                    HitArea   hitDetector = hitInfo.collider.GetComponent <HitArea>();
                    Character character   = hitDetector.GetCharacter();
                    switch (character.GetCharacterType())
                    {
                    case eCharacterType.MONSTER:
                        //적으로 파악 => 추적 state
                        _targetObject = hitInfo.collider.gameObject;
                        ChangeState(eState.CHASE);
                        break;
                    }
                }
            }
        }

        //for test
        if (InputManager.Instance.IsAttackButtonDown())
        {
            ChangeState(eState.ATTACK);
        }
    }
Ejemplo n.º 30
0
        public DrawableHitCircle(HitCircle h)
            : base(h)
        {
            Origin = Anchor.Centre;

            Position = HitObject.StackedPosition;

            InternalChildren = new Drawable[]
            {
                scaleContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Origin           = Anchor.Centre,
                    Anchor           = Anchor.Centre,
                    Children         = new Drawable[]
                    {
                        hitArea = new HitArea
                        {
                            Hit = () =>
                            {
                                if (AllJudged)
                                {
                                    return(false);
                                }

                                UpdateResult(true);
                                return(true);
                            },
                        },
                        new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
                        ApproachCircle = new ApproachCircle
                        {
                            Alpha = 0,
                            Scale = new Vector2(4),
                        }
                    }
                },
            };

            Size = hitArea.DrawSize;
        }
Ejemplo n.º 31
0
 /// <include file='doc\MonthCalendar.uex' path='docs/doc[@for="MonthCalendar.HitTestInfo.HitTestInfo"]/*' />
 /// <devdoc>
 /// </devdoc>
 /// <internalonly/>
 internal HitTestInfo(Point pt, HitArea area, DateTime time) {
     this.point = pt;
     this.hitArea = area;
     this.time = time;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HitTestInfo"/> class. 
 /// </summary>
 /// <param name="buttonIndex">Index of button</param>
 /// <param name="area"><see cref="HitArea"/> representing what was hit area of a given point.</param>
 public HitTestInfo(int buttonIndex, HitArea area)
 {
     this.buttonIndex = buttonIndex;
     this.area = area;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HitTestInfo"/> class. 
 /// </summary>
 /// <param name="area"><see cref="HitArea"/> representing what was hit area of a given point.</param>
 public HitTestInfo(HitArea area)
 {
     buttonIndex = -1;
     this.area = area;
 }
Ejemplo n.º 34
0
 internal HitTestInfo(Point location, HitArea area, IToolboxObject tool)
 {
     this._hitPoint = location;
     this._hitArea = area;
     this._hitTool = tool;
 }
Ejemplo n.º 35
0
			// default constructor
			internal HitTestInfo () {
				hit_area = HitArea.Nowhere;
				point = new Point (0, 0);
				time = DateTime.Now;
			}
Ejemplo n.º 36
0
			// overload receives all properties
			internal HitTestInfo (HitArea hit_area, Point point, DateTime time, DateTime hit_time)
			{
				this.hit_area = hit_area;
				this.point = point;
				this.time = time;
				this.hit_time = hit_time;
			}
Ejemplo n.º 37
0
			internal HitTestInfo (HitArea hit_area, Point point, DateTime time, HitAreaExtra hit_area_extra)
			{
				this.hit_area = hit_area;
				this.hit_area_extra = hit_area_extra;
				this.point = point;
				this.time = time;
			}
Ejemplo n.º 38
0
 /// <include file='doc\MonthCalendar.uex' path='docs/doc[@for="MonthCalendar.HitTestInfo.HitTestInfo1"]/*' />
 /// <devdoc>
 ///      This constructor is used when the DateTime member is invalid.
 /// </devdoc>
 /// <internalonly/>
 internal HitTestInfo(Point pt, HitArea area) {
     this.point = pt;
     this.hitArea = area;
 }
Ejemplo n.º 39
0
 /// <include file='doc\MonthCalendar.uex' path='docs/doc[@for="MonthCalendar.HitTestInfo.HitAreaHasValidDateTime"]/*' />
 /// <devdoc>
 ///      Determines whether a given HitArea should have a corresponding valid DateTime
 /// </devdoc>
 /// <internalonly/>
 internal static bool HitAreaHasValidDateTime(HitArea hitArea) {
     switch (hitArea) {
         case HitArea.Date:
             //case HitArea.DayOfWeek:   comCtl does not provide a valid date
         case HitArea.WeekNumbers:
             return true;
     }
     return false;
 }