Inheritance: MonoBehaviour
コード例 #1
0
ファイル: plKiroch.cs プロジェクト: cWalters2/ShSoul
    public void Awake()
    {
        PROJ_LMT = 3;
        chLv = 2.0f;
        chMx = 4.0f;
        stunTimer = new STimer ();
        thwTmr = new STimer (throwTime);
        grbTmr = new STimer (grabTime);
        attackBox=new AttkBox(KIR_NUMANIMS);
        hitbox = new HitBox();

        LoadPlayer ();
        stats.id.fighter = KIROCH;

        chargeT=0;
        if (projectile == null)
            projectile = new plProjectile[PROJ_LMT];
        for (int i=0; i<PROJ_LMT; i++)
            projectile [i]=new plProjectile();
        for(int i=0;i<PROJ_LMT;i++){
            projectile[i].SetAtkData(12.0f, 1.6f, 2.0f);
            projectile[i].Scale(5.0f);
            projectile[i].ps = fireBall[i];
        }
        sbSpd=0;
        scSpd=0;
    }
コード例 #2
0
ファイル: CPU.cs プロジェクト: TowerTin/SourceCode
    public CPU(GraphicsDevice g, SpriteBatch _sprite, int[,] _m, int eneNo)
    {
        pos = new Vector2[BLASTSU];

        x = new int[BLASTSU];
        y = new int[BLASTSU];
        x1 = new int[BLASTSU];
        y1 = new int[BLASTSU];
        swh = new int[BLASTSU];
        hp = new int[BLASTSU];
        mapNo = new int[BLASTSU];
        lv = new int[BLASTSU];
        sped = new int[BLASTSU];
        kougeki = new int[BLASTSU];
        cont = new int[BLASTSU];
        hb = new HitBox();
        map = _m;

        TBlast = new Texture2D[64];
        gname = new int[BLASTSU];
        gname2 = new int[BLASTSU];
        for (int i = 0; i < BLASTSU; i++)
        {
            //初期化
            gname[i] = 0;
            gname2[i] = 0;
            pos[i].X = -30;
            pos[i].Y = 88;
            x1[i] = 1;
            y1[i] = 0;
            swh[i] = 0;
            mapNo[i] = -1;
            hp[i] = enemystat[eneNo, 0];
            lv[i] = 99;
            cont[i] = 10;
            sped[i] = 0;
        }

        for (int i = 0; i < 64; i++)
        {
            //敵ユニットの画像の取得
            if (i < 32)
            {
                using (Stream stream = File.OpenRead("img/Tr" + i + ".png"))
                {
                    TBlast[i] = Texture2D.FromStream(g, stream);

                }
            }
            else if (i < 64)
            {
                using (Stream stream = File.OpenRead("img/en" + (i - 32) + ".png"))
                {
                    TBlast[i] = Texture2D.FromStream(g, stream);

                }
            }
        }
        sprite = _sprite;
    }
コード例 #3
0
	void Start () {
		anim 			 = GetComponent<Animator> ();
		collisions 	 	 = GetComponent<CollisionsController> ();
		wallInteractions = GetComponent<HitBox> ();
		currHp 			 = maxHp;
		currStamina 	 = maxStamina;
		gravity 	 	 = -(2 * maxJumpHeight) / Mathf.Pow (timeToJumpApex, 2);
		maxJumpVelocity  = Mathf.Abs (gravity) * timeToJumpApex; 	
		minJumpVelocity  = Mathf.Sqrt (2 * Mathf.Abs (gravity) * minJumpHeight);
		doInput = true;
	}
コード例 #4
0
ファイル: EnemyPatrol2D.cs プロジェクト: devNaroo/2DWalker
	public void KillFromAbove(HitBox other, Collider me) {
		if (!hasHitPlayer && other != null && other.simplehealth != null) {
			// If we can find a character controller 
			RaycastCharacterController2D hero = other.simplehealth.GetComponent<RaycastCharacterController2D>();
			if (hero != null) {
				me.collider.enabled = false;
				Kill();
				hero.Velocity = new Vector2(hero.Velocity.x, bounceVelocity);
			}
		}
	}	
コード例 #5
0
 public override void OnSelectionChanged()
 {
     if (Selection.activeGameObject != null)
     {
         externalArmorSelected = Selection.activeGameObject.GetComponent <HitBox>();
         if (externalArmorSelected != null)
         {
             armorType      = externalArmorSelected.hitBoxType;
             ArmorThickness = externalArmorSelected.Armor;
         }
     }
 }
コード例 #6
0
        public ProfileGump(uint serial, string header, string footer, string body, bool canEdit) : base(serial == World.Player.Serial ? serial = Constants.PROFILE_LOCALSERIAL : serial, serial)
        {
            Height                 = 300 + _diffY;
            CanMove                = true;
            AcceptKeyboardInput    = true;
            CanCloseWithRightClick = true;

            Add(_gumpPic = new GumpPic(143, 0, 0x82D, 0));
            _gumpPic.MouseDoubleClick += _picBase_MouseDoubleClick;
            Add(_scrollExp             = new ExpandableScroll(0, _diffY, Height - _diffY, 0x0820));
            _scrollArea = new ScrollArea(0, 32 + _diffY, 272, Height - (96 + _diffY), false);

            Control c = new Label(header, true, 0, font: 1, maxwidth: 140)
            {
                X = 85,
                Y = 0
            };

            _scrollArea.Add(c);
            AddHorizontalBar(_scrollArea, 92, 35, 220);

            _textBox = new StbTextBox(1, -1, 220, true, hue: 0)
            {
                Height     = FontsLoader.Instance.GetHeightUnicode(1, body, 220, TEXT_ALIGN_TYPE.TS_LEFT, 0x0),
                Width      = 220,
                X          = 35,
                Y          = 0,
                IsEditable = canEdit,
                Multiline  = true
            };
            _originalText = body;
            _textBox.SetText(body);

            if (_textBox.Height < 50)
            {
                _textBox.Height = 50;
            }

            _textBox.TextChanged += _textBox_TextChanged;
            _scrollArea.Add(_textBox);
            AddHorizontalBar(_scrollArea, 95, 35, 220);

            _scrollArea.Add(new Label(footer, true, 0, font: 1, maxwidth: 220)
            {
                X = 35,
                Y = 0
            });
            Add(_scrollArea);

            Add(_hitBox      = new HitBox(143, 0, 23, 24));
            _hitBox.MouseUp += _hitBox_MouseUp;
        }
コード例 #7
0
        public override HitBox HitTest()
        {
            if (!IsVisible())
            {
                return(HitBox.Miss);
            }
            HitBox hit;

            if ((hit = _scrollBar.HitTest()).IsHit)
            {
                return(hit);
            }

            if (Categories.ViewAsImageList)
            {
                for (int i = VerticalScrollIndex;
                     i < _items.Count && i - VerticalScrollIndex < VerticalMaxVisibleItems;
                     i++)
                {
                    if (!_items[i].HitTest())
                    {
                        continue;
                    }
                    _selectedItem = _items[i];
                    OnSelect?.Invoke(_items[i].Value);
                    return(HitBox.Hit(this));
                }
            }
            else
            {
                for (int i = VerticalScrollIndex * HorizontalMaxVisibleItems;
                     i < _items.Count && i - (VerticalScrollIndex * HorizontalMaxVisibleItems) < MaxVisibleItemsTotal;
                     i++)
                {
                    if (!_items[i].HitTest())
                    {
                        continue;
                    }
                    _selectedItem = _items[i];
                    OnSelect?.Invoke(_items[i].Value);
                    return(HitBox.Hit(this));
                }
            }

            _clickable.HitTest(MouseButton.Left);
            if (_clickable.IsDown(MouseButton.Left))
            {
                return(HitBox.Hit(this));
            }

            return(HitBox.Miss);
        }
コード例 #8
0
ファイル: Dummy.cs プロジェクト: Gmyth/D.I.V.E.
    public void EnableHitBox(int index)
    {
        HitBox hitBox = hitBoxes[index];


        OnEnableHitBox.Invoke(hitBox);


        hitBox.gameObject.SetActive(true);


        ++numEnabledHitBoxes;
    }
コード例 #9
0
 protected AbstractGameObject(ISprite sprite, Vector2 position, Color hitBoxColor)
 {
     BoundingBox = new HitBox(0, 0, 0, 0, hitBoxColor);
     Sprite      = sprite;
     Position    = position;
     Velocity    = new Vector2(0, 0);
     Orientation = Facing.Right;
     Visible     = true;
     Removed     = false;
     DrawOrder   = .5f;
     SpriteTint  = Color.White;
     LevelArea   = 0;
 }
コード例 #10
0
    public void OnHurtBox_AreaEntered(HitBox area)
    {
        InteractionData <HealthComponent> data;

        data.Weapon     = area.Weapon;
        data.TargetData = this._healthComponent;
        new TakeDamageAction().Execute(data);

        this.OnHurtHandler(data);


        // Replace with function body.
    }
コード例 #11
0
        private static bool RectangleCircleIntersection(HitBox box, HitBox circle, ref Coordinate intersectionPoint)
        {
            bool doesIntersect = false;

            if (PointCircleleIntersection(box.pointA, circle))
            {
                intersectionPoint = box.pointA;
                doesIntersect     = true;
            }


            return(doesIntersect);
        }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        // for test
        isWorking = true;
        outSlot   = new Slot();
        outHitBox = GetComponentInChildren <HitBox>();

        outHitBox.onTriggerTransport += delegate(TransportByCollider transport) {
            outTransport = outHitBox.transport;
        };

        animator = GetComponentInChildren <Animator>();
    }
コード例 #13
0
    /// <summary>
    /// Coin spanws from inside a box and is automatically collected.
    /// </summary>
    public void Spawn(Vector3 spawnForce)
    {
        isBrickCoin          = true;
        rigidbody.useGravity = true;
        rigidbody.AddForce(spawnForce, ForceMode.VelocityChange);
        StartCoroutine(DoAutoCollect());
        HitBox box = GameObject.FindObjectOfType(typeof(HitBox)) as HitBox;

        if (box != null)
        {
            box.Collect(this);
        }
    }
コード例 #14
0
ファイル: HitManager.cs プロジェクト: damandamn/DYOOL
    //Alters angle based on directional influence, reverse hit, etc
    float CalculateAngle(HitBox attack, PlayerController user, PlayerController enemy)
    {
        float angle = attack.angle;

        //reverses angle if attacker is reversed
        if (!user.isFacingLeft)
        {
            angle = 180 - angle;
        }

        //reverses angle if it is reversable and the enemy is behind the user
        if (attack.reverseHit)
        {
            if (user.isFacingLeft)
            {
                if (attack.angle < 90)
                {
                    if (user.transform.position.x > enemy.transform.position.x)
                    {
                        angle = 180 - angle;
                    }
                }
                else
                {
                    if (user.transform.position.x < enemy.transform.position.x)
                    {
                        angle = 180 - angle;
                    }
                }
            }
            else
            {
                if (attack.angle < 90)
                {
                    if (user.transform.position.x < enemy.transform.position.x)
                    {
                        angle = 180 - angle;
                    }
                }
                else
                {
                    if (user.transform.position.x > enemy.transform.position.x)
                    {
                        angle = 180 - angle;
                    }
                }
            }
        }

        return(angle);
    }
コード例 #15
0
ファイル: BruteAI.cs プロジェクト: PumpkinEggnog/FlintsFall
    void FixedUpdate()
    {
        HitBox hitbox   = GetComponentInChildren <HitBox>();
        float  distance = Vector3.Distance(target.position, transform.position);

        if (distance <= sightRadius)                //if the player moves into line of sight
        {
            agent.SetDestination(target.position);  //move towards the player
            if (distance <= agent.stoppingDistance) //checks to see if the mutant is next to the player
            {
                FaceTarget();                       //causes AI to face player
            }
        }
    }
コード例 #16
0
ファイル: Action_Attack.cs プロジェクト: gbxsjia/Sekiro
    protected override void Effect()
    {
        base.Effect();
        GameObject g     = Instantiate(HitBox, Caster.transform.position, Quaternion.identity);
        Vector3    scale = Vector3.one;

        scale.x = direction;
        g.transform.localScale = scale;

        HitBox hb = g.GetComponent <HitBox>();

        hb.InitHitBox(Caster.gameObject, Damage, Caster.camp, canBlock, canParry);
        Destroy(g, duration);
    }
コード例 #17
0
    public void Disarm()
    {
        //Disarms the target preventing it from attacking for 3 seconds.
        PlayerAttack PA = FindObjectOfType <PlayerAttack>();

        PA.isAttacking = true;
        PA.meleeWeapon.GetComponent <Collider>().enabled = true;
        HitBox hit = FindObjectOfType <HitBox>();

        sword.SetBool("isSword1", true);
        hit.ChanageStatus(2);
        SwordParticle.SetActive(true);
        SwordParticle.GetComponent <TrailRenderer>().colorGradient = DisarmGradient;
    }
コード例 #18
0
    public void Rend()
    {
        //Slashes the target doing 10 bleed damage every 1 second for 6 seconds.
        PlayerAttack PA = FindObjectOfType <PlayerAttack>();

        PA.isAttacking = true;
        PA.meleeWeapon.GetComponent <Collider>().enabled = true;
        HitBox hit = FindObjectOfType <HitBox>();

        sword.SetBool("isSword1", true);
        hit.ChanageStatus(1);
        SwordParticle.SetActive(true);
        SwordParticle.GetComponent <TrailRenderer>().colorGradient = RendGradient;
    }
コード例 #19
0
ファイル: ActCtrl.cs プロジェクト: nmbswls/Platform2DTest
    public void OnBoxHit(AtkBox box, Collider2D other)
    {
        int idx = AtkBoxes.IndexOf(box);

        HitBox oppo  = other.GetComponent <HitBox>();
        int    skill = SKillMap[idx];

        ApplyAtk();
        Vector2 pos = GetHitEffectPosition(box, oppo);

        oppo.owner.GetHit();
        GameObject.Instantiate(Resources.Load <GameObject>("Effect01"), pos, Quaternion.identity, null);
        //GameObject.Instantiate();
    }
コード例 #20
0
        public BulletinBoardGump(uint serial, int x, int y, string name) : base(serial, 0)
        {
            X       = x;
            Y       = y;
            CanMove = true;
            CanCloseWithRightClick = true;

            Add(new GumpPic(0, 0, 0x087A, 0));

            Label label = new Label(name, true, 1, 170, 1, align: TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X = 159,
                Y = 36
            };

            Add(label);

            HitBox hitbox = new HitBox(15, 170, 80, 80)
            {
                Alpha = 1
            };

            hitbox.MouseUp += (sender, e) =>
            {
                UIManager.GetGump <BulletinBoardItem>(LocalSerial)?.Dispose();

                UIManager.Add
                (
                    new BulletinBoardItem
                        (LocalSerial, 0, World.Player.Name, string.Empty, ResGumps.DateTime, string.Empty, 0)
                {
                    X = 400, Y = 335
                }
                );
            };

            Add(hitbox);

            ScrollArea area = new ScrollArea(127, 159, 241, 195, false);

            Add(area);

            _databox = new DataBox(0, 0, 1, 1);
            _databox.WantUpdateSize = true;

            area.Add(_databox);


            // TODO: buuttons
        }
コード例 #21
0
ファイル: HitBox.cs プロジェクト: brucelevis/pacing-fighter
    /// <summary>
    /// Initializes a new instance of the <see cref="HitBox"/> class by copying the values from the
    /// given template.
    /// </summary>
    public HitBox(HitBox template)
    {
        // Copy the data fields from the given templates
        this.hitBoxType = template.hitBoxType;
        this.boneName   = template.boneName;
        this.offset     = template.offset;
        this.size       = template.size;

        // Duplicate the 'hitFrames' array
        this.hitFrames = ArrayUtils.Copy <int>(template.hitFrames);

        // Create a deep copy of the HitInfo instance>
        this.hitInfo = new HitInfo(template.hitInfo);
    }
コード例 #22
0
    public void FireRifle()
    {
        if (HuntingRifleTimer < 1)
        {
            if (HuntingRifleMagazine > 0)
            {
                NPCmanager.GetComponent <NpcManagement>().JustFired();                              //lets NPCs know you fired, so they can look for you
                HuntingRifle.GetComponent <Animator>().SetTrigger("Fire");                          //HuntingRifle.GetComponent<Animator>().SetTrigger("Fire");  //plays a firing animation
                Instantiate(muzzleflash, HuntingRifleMuzzle.position, HuntingRifleMuzzle.rotation); //muzzleflash
                Instantiate(smoke, HuntingRifleMuzzle.position, HuntingRifleMuzzle.rotation);       //gunsmoke

                //stores location of raycast hit
                RaycastHit hit;
                //makes raycast avoid game-layer with player and ui

                int layerMask = (1 << 8) | (1 << 9);
                layerMask = ~layerMask;
                //casts ray
                if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, HuntingRifleRange, layerMask))
                {
                    //makes an impact particle effect


                    HitBox target = hit.transform.GetComponent <HitBox>();         // this checks to see if object hit has a certain script
                    if (target != null)
                    {
                        target.HitByProjectile(HuntingRifleDamage);
                        GameObject blik = Instantiate(blood, hit.point, Quaternion.LookRotation(hit.normal)) as GameObject;
                        blik.transform.SetParent(target.transform);
                        GameObject smokes = Instantiate(sparks, hit.point, Quaternion.LookRotation(hit.normal)) as GameObject;
                        smokes.transform.SetParent(target.transform);
                    }
                    else
                    {
                        Instantiate(sparks, hit.point, Quaternion.LookRotation(hit.normal));
                    }
                }



                cam.transform.rotation *= Quaternion.Euler(-.1f, 0, 0.0f);

                HuntingRifleMagazine -= 1;
                activemagazine        = HuntingRifleMagazine;

                hud.AmmoUpdate();
                HuntingRifleTimer = 4;
            }
        }
    }
コード例 #23
0
ファイル: EnemyPatrol.cs プロジェクト: keiranlovett/Nocturnal
 public void KillFromAbove(HitBox other, Collider me)
 {
     if (!hasHitPlayer && other != null && other.simplehealth != null)
     {
         // If we can find a character controller
         RaycastCharacterController hero = other.simplehealth.GetComponent <RaycastCharacterController>();
         if (hero != null)
         {
             me.collider.enabled = false;
             Kill();
             hero.Velocity = new Vector2(hero.Velocity.x, bounceVelocity);
         }
     }
 }
コード例 #24
0
    void OnTriggerEnter(Collider collider)
    {
        HitBox hitBox = collider.GetComponent <HitBox>();

        if (hitBox)
        {
            if (shooter.tag == hitBox.transform.parent.tag)
            {
                return;
            }
            hitBox.Hit();
            gameObject.SetActive(false);
        }
    }
コード例 #25
0
    public virtual HitBox StandardAttack(Attack atk)
    {
        thisPlayer.SetStun(atk.lag);
        GameObject newHitBox = Instantiate(atk.HB, this.transform.forward + this.transform.position, this.transform.rotation);

        NetworkServer.Spawn(newHitBox);
        Destroy(newHitBox, atk.hbDuration + atk.delay);
        HitBox thisHB = newHitBox.GetComponent <HitBox>();

        thisHB.creator = this.gameObject;
        thisHB.Setup(atk);
        attackQueue.Add(thisHB);
        return(thisHB);
    }
コード例 #26
0
    public HitBox CreateBabyBotExplosion(Vector3 position)
    {
        // Create the visual effect // TODO: POOL THE VISUAL
        GameObject clonedParticle = (GameObject)Instantiate(_babyBotExplosion, position, Quaternion.identity);

        Destroy(clonedParticle, 5.0f);

        // Create what actually does the damage
        HitBox babyBotHitbox = GetHitbox();

        babyBotHitbox.MakeBabyBotExplosion();
        babyBotHitbox.transform.position = position;
        return(babyBotHitbox);
    }
コード例 #27
0
 public void ReceiveHit(HitBox hitbox)
 {
     foreach (var d in defense)
     {
         HitBox worldSpace = new HitBox(d, transform);
         if (hitbox.Hit(worldSpace))
         {
             Debug.Log("Hit! ");
             Debug.DrawLine(worldSpace._position, worldSpace._position + worldSpace._size, Color.green, 15f);
             Debug.DrawLine(hitbox._position, hitbox._position + hitbox._size, Color.magenta, 15f);
             handler.ReceiveHit(hitbox);
         }
     }
 }
コード例 #28
0
        protected Rectangle sourceRectangle;           // Rectangle of tile that will ben drawn

        // Constructor
        public Ground(GameScreen gameScreen, TileMap tileMap) : base(gameScreen)
        {
            // set tilemap
            this.tileMap = tileMap;

            // Load standard properties
            HitBox      hitBox   = new HitBox(this);
            BoxCollider collider = new BoxCollider();

            collider.Size = MainGame.TILE_SIZE;
            hitBox.SetCollider(collider);
            AddComponent(hitBox);
            hitBox.Solid = true;
        }
コード例 #29
0
    public void Start()
    {
        rB = GetComponent <Rigidbody2D>();
        //anim = GetComponent<Animator>();
        anim = GetComponent <PlayerAnimator>();
        //canvasTransform = GameObject.Find("UI").transform;

        staminaBar            = GameObject.FindGameObjectWithTag("StaminaBar").GetComponent <Image>();
        healthBar             = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <Image>();
        staminaBar.fillAmount = 1f;
        healthBar.fillAmount  = 1f;

        gameManager = GameObject.Find("GameManager");
        MD          = gameManager.GetComponent <MapDrawer>();
        dungeon     = gameManager.GetComponent <DungeonGenerator>();

        //////////////////////////////////////////////////////////////////////
        ///HIT BOX не беретс¤/////////////////////////////////////////////

        mapk             = MD.mapk;
        mapWidth         = dungeon.mapWidth;
        mapHeight        = dungeon.mapHeight;
        health           = maxHealth;
        stamina          = maxStamina;
        defence          = 1;
        staminaPerAttack = 30;
        isDied           = false;

        foreach (var hitBox in hitBoxes)
        {
            HitBox hB = hitBox.GetComponent <HitBox>();
            hB.damage = damage;
            hB.thrust = strength;
            hB.owner  = "Player";
        }

        curEffectsIncrease = new Dictionary <typeEnum, float>
        {
            [typeEnum.speed]    = 0,
            [typeEnum.stamina]  = 0,
            [typeEnum.strength] = 0
        };
        curEffectsDuring = new Dictionary <typeEnum, float>
        {
            [typeEnum.speed]    = 0,
            [typeEnum.stamina]  = 0,
            [typeEnum.strength] = 0
        };
    }
コード例 #30
0
 /* Boxcasts to find the current item in reach, updating itemInReach if they
 do not match. */
 void UpdateReach()
 {
     Vector3 center = cam ? cam.transform.position : head.transform.position;
     Vector3 halfExtents = new Vector3(0.25f,0.25f,0.25f);
     Vector3 direction = cam ? cam.transform.forward : head.transform.forward;
     Quaternion orientation = cam ? cam.transform.rotation : head.transform.rotation;
     float distance = 5f;
     int layerMask = ~(1 << 8);
     RaycastHit[] found = Physics.BoxCastAll(
       center,
       halfExtents,
       direction,
       orientation,
       distance,
       layerMask,
       QueryTriggerInteraction.Ignore
     );
     bool itemFound = false;
     for(int i = 0; i < found.Length; i++){
       Item item = found[i].collider.gameObject.GetComponent<Item>();
       if(item && GetRoot(item.gameObject.transform) != transform && item.displayName != ""){
     itemInReach = item.gameObject;
     itemFound = true;
     break;
       }
     }
     if(!itemFound){ itemInReach = null; }
     bool actorFound = false;
     for(int i = 0; i < found.Length; i++){
       Actor other = found[i].collider.gameObject.GetComponent<Actor>();
       HitBox hb = found[i].collider.gameObject.GetComponent<HitBox>();
       if(other && other != this){
     actorInReach = other.gameObject;
     actorInReachName = other.displayName;
     actorFound = true;
     break;
       }
       else if(hb != null){
     if(hb.body && hb.body != this){
       actorInReach = hb.body.gameObject;
       actorInReachName = hb.body.displayName;
       actorFound = true;
       break;
     }
       }
     }
     if(!actorFound){ actorInReach = null; }
     return;
 }
コード例 #31
0
    public bool canShoot = true; //Можно ли стрелять в данный момент?

    #endregion                   //parametres

    /// <summary>
    /// Функция выстрела из оружия
    /// </summary>
    public virtual void Shoot(HitBox hitBox, Vector3 position, int orientation, LayerMask whatIsAim, List <string> enemies)
    {
        hitBox.StartCoroutine(DontShootProcess());
        RaycastHit2D[] hits = new RaycastHit2D[] { Physics2D.Raycast(position, orientation * Vector3.right, shootDistance, whatIsAim),
                                                   Physics2D.Raycast(position + shootDelta * Vector3.up, orientation * Vector3.right, shootDistance, whatIsAim),
                                                   Physics2D.Raycast(position + Vector3.up * shootDelta / 2f, orientation * Vector3.right, shootDistance, whatIsAim),
                                                   Physics2D.Raycast(position + Vector3.up * (-shootDelta / 2f), orientation * Vector3.right, shootDistance, whatIsAim),
                                                   Physics2D.Raycast(position + Vector3.up * (-shootDelta), orientation * Vector3.right, shootDistance, whatIsAim),
                                                   Physics2D.Raycast(position + Vector3.up * (-1.5f * shootDelta), orientation * Vector3.right, shootDistance, whatIsAim) };
        Vector2 endPoint = position + orientation * Vector3.right * (shootDistance + .1f);

        if (hits[0] || hits[1] || hits[2] || hits[3] || hits[4] || hits[5])
        {
            IDamageable target   = null;
            int         hitIndex = -1;
            for (int i = 0; i < 5; i++)
            {
                if (hits[i].collider != null ? (target = hits[i].collider.gameObject.GetComponent <IDamageable>()) != null : false)
                {
                    GameObject targetObj = hits[i].collider.gameObject;
                    if (enemies.Contains(targetObj.tag))
                    {
                        hitIndex = i;
                        target.TakeDamage(damage);
                        break;
                    }
                }
            }
            if (hitIndex == -1 && hits[0])
            {
                hitIndex = 1;
                GameObject _bullet = GameObject.Instantiate(arrow, new Vector3(hits[0].point.x, hits[0].point.y, position.z), Quaternion.identity) as GameObject;
                Vector3    vect    = _bullet.transform.localScale;
                _bullet.transform.localScale = new Vector3(orientation * vect.x, vect.y, vect.z);
            }
            if (hitIndex != -1)
            {
                endPoint = hits[hitIndex].point;
            }
        }
        line          = hitBox.gameObject.AddComponent <LineRenderer>();
        line.material = arrowMaterial;
        line.SetWidth(.01f, .01f);
        line.SetVertexCount(2);
        line.SetPosition(0, position);
        line.SetPosition(1, new Vector3(endPoint.x, endPoint.y, position.z));
        line.SetColors(new Color(1f, 1f, 1f, .5f), new Color(1f, 1f, 1f, .5f));
        Destroy(line, .1f);
    }
コード例 #32
0
        public MapGump(uint serial, ushort gumpid, int width, int height) : base(serial, 0)
        {
            AcceptMouseInput       = false;
            CanMove                = true;
            CanCloseWithRightClick = true;
            Width  = width;
            Height = height;

            WantUpdateSize = false;

            Add
            (
                new ResizePic(0x1432)
            {
                Width = width + 44, Height = height + 61
            }
            );


            Add(_buttons[0] = new Button((int)ButtonType.PlotCourse, 0x1398, 0x1398)
            {
                X = (width - 100) >> 1, Y = 5, ButtonAction = ButtonAction.Activate
            });

            Add(_buttons[1] = new Button((int)ButtonType.StopPlotting, 0x1399, 0x1399)
            {
                X = (width - 70) >> 1, Y = 5, ButtonAction = ButtonAction.Activate
            });

            Add(_buttons[2] = new Button((int)ButtonType.ClearCourse, 0x139A, 0x139A)
            {
                X = (width - 66) >> 1, Y = height + 37, ButtonAction = ButtonAction.Activate
            });

            _buttons[0].IsVisible = _buttons[0].IsEnabled = PlotState == 0;

            _buttons[1].IsVisible = _buttons[1].IsEnabled = PlotState == 1;

            _buttons[2].IsVisible = _buttons[2].IsEnabled = PlotState == 1;



            _hit = new HitBox(24, 31, width, height, null, 0f);
            Add(_hit);

            _hit.MouseUp += TextureControlOnMouseUp;

            Add(new GumpPic(width - 20, height - 20, 0x0139D, 0));
        }
コード例 #33
0
 /* Exert force and damage onto target. */
 protected void Strike(Collider col, int dmg = 0)
 {
     if (col.gameObject == null)
     {
         MonoBehaviour.print("Gameobject missing"); return;
     }
     if (damageActive)
     {
         if (holder != null)
         {
             if (holder.GetRoot(col.gameObject.transform) == holder.transform.transform)
             {
                 return;
             }
         }
         HitBox hb = col.gameObject.GetComponent <HitBox>();
         if (hb)
         {
             StartCoroutine(CoolDown(cooldown));
             if (dmg == 0)
             {
                 dmg = damage;
             }
             Damage dam = new Damage(dmg, gameObject);
             hb.ReceiveDamage(dam);
             damageActive = false;
             if (hb.body != null)
             {
                 Rigidbody hbrb    = hb.body.gameObject.GetComponent <Rigidbody>();
                 Vector3   forward = transform.position - hb.body.transform.position;
                 forward = new Vector3(forward.x, 0f, forward.y);
                 if (hbrb)
                 {
                     hbrb.AddForce(forward * knockBack);
                 }
             }
         }
         Rigidbody rb = col.gameObject.GetComponent <Rigidbody>();
         if (rb)
         {
             rb.AddForce(transform.forward * knockBack); Sound(0);
         }
         Item item = col.gameObject.GetComponent <Item>();
         if (item != null && !(item is Ability) && item.holder != null)
         {
             item.holder.Drop(item);
         }
     }
 }
コード例 #34
0
    void Start()
    {
        ragdoll             = GetComponent <RagdollScript>();
        currentHealth       = maxHealth;
        skinnedMeshRenderer = GetComponentInChildren <SkinnedMeshRenderer>();
        healthbar           = GetComponentInChildren <UIHealth>();

        var rigidBodies = GetComponentsInChildren <Rigidbody>();

        foreach (var rigidbody in rigidBodies)
        {
            HitBox hitBox = rigidbody.gameObject.AddComponent <HitBox>();
            hitBox.health = this;
        }
    }
コード例 #35
0
ファイル: Bullet.cs プロジェクト: Insane-96/StupidAivGame
 // collisionDirection: 0: X collision ; 1: Y collision
 private bool BounceOrDie(int collisionDirection, HitBox colliderHitBox)
 {
     if (bounceBullet) {
         Console.WriteLine ("Collision direction:" + collisionDirection);
         if (collisionDirection == 0) {
             direction.X *= -1;
             virtPos.X = 0;
         } else if (collisionDirection == 1) {
             direction.Y *= -1;
             virtPos.Y = 0;
         } else {
             // if the collission simulation failed (ex. reason: multiple moving stuff?)
             //  then bounce back
             virtPos.X = 0;
             virtPos.Y = 0;
             direction.X *= -1;
             direction.Y *= -1;
         }
         speed = (int) (speed * bounceMod);
         if (speed <= MINSPEED)
             speed = MINSPEED;
         else
             rangeToGo = (int) (rangeToGo * bounceMod);
         lastBounce = bounceDelay;
         this.x = (int)lastPoint.X;
         this.y = (int)lastPoint.Y;
         return true;
     } else {
         this.Destroy ();
         return false;
     }
 }
コード例 #36
0
ファイル: plSerenity.cs プロジェクト: cWalters2/ShSoul
    // Use this for initialization
    public void Awake()
    {
        PROJ_LMT = 0;
        stunTimer = new STimer ();
        thwTmr = new STimer (throwTime);
        grbTmr = new STimer (grabTime);
        scTmr = new STimer ();
        spa1 = new STimer ();
        spb1 = new STimer ();
        spc1 = new STimer ();
        spc2 = new STimer ();
        spc3 = new STimer ();
        spaTmr = new STimer (1.5f);
        hitbox = new HitBox();
        fHelper = new FighterHelper ();

        stats.id.fighter = SERENITY;
        attackBox=new AttkBox(SER_NUMANIMS);
        stats.tumble.loop=true;
        //psysword=plSerenSword(plNum);
        scSpd=0;

        //for(int i=0;i<PROJ_LMT;i++){
        //	projectile[i].SetAtkData(12.0f, 1.6f, 2.0f);
        //	projectile[i].Scale(5.0f);
        //}

        scSpd=0;

        GameObject goSword = Instantiate(Resources.Load("SerenSword")) as GameObject;
        DontDestroyOnLoad(goSword);

        psysword = goSword.GetComponent ("plSerenSword") as plSerenSword;
        psysword.fHelper.TR.Rotate (0, -90, 0);
        psysword.fHelper.FaceRight (true);
        LoadPlayer ();
        psysword.transform.position = new Vector3 (transform.position.x + 10, transform.position.y + 10, 0);
        psysword.stats.motion.pos = new SPoint (transform.position.x + 10, transform.position.y + 10);
        psysword.plNum=11;
    }
コード例 #37
0
	public void KillFromAbove(HitBox other, Collider me) {
		Kill ();
	}
コード例 #38
0
ファイル: GameObject.cs プロジェクト: unbit/aivengine
 public bool CollideWith(HitBox other)
 {
     int x1 = this.owner.x + this.x;
     int y1 = this.owner.y + this.y;
     int x2 = other.owner.x + other.x;
     int y2 = other.owner.y + other.y;
     // simple rectangle collision check
     if (x1 + this.width >= x2 &&
         x1 <= (x2 + other.width) &&
         y1 + this.height >= y2 &&
         y1 <= (y2 + other.height))
         return true;
     // no collision
     return false;
 }
コード例 #39
0
ファイル: GameObject.cs プロジェクト: unbit/aivengine
 public void AddHitBox(string name, int x, int y, int width, int height)
 {
     if (this.hitBoxes == null) {
         this.hitBoxes = new Dictionary<string, HitBox> ();
     }
     HitBox hbox = new HitBox (name, x, y, width, height);
     hbox.owner = this;
     this.hitBoxes [name] = hbox;
 }
コード例 #40
0
 public float TestCollision(HitBox[] opHitBoxes)
 {
     float totalPushForce = 0;
     foreach (HitBox hitBox in hitBoxes) {
         if (hitBox.collisionType != CollisionType.bodyCollider) continue;
         foreach (HitBox opHitBox in opHitBoxes) {
             if (opHitBox.collisionType != CollisionType.bodyCollider) continue;
             Vector3 opHitBoxPosition = opHitBox.position.position;
             Vector3 hitBoxPosition = hitBox.position.position;
             if (!UFE.config.detect3D_Hits){
                 opHitBoxPosition = new Vector3(opHitBox.position.position.x, opHitBox.position.position.y, 0);
                 hitBoxPosition = new Vector3(hitBox.position.position.x, hitBox.position.position.y, 0);
             }
             float dist = Vector3.Distance(opHitBoxPosition, hitBoxPosition);
             if (dist <= opHitBox.radius + hitBox.radius) totalPushForce += (opHitBox.radius + hitBox.radius) - dist;
         }
     }
     return totalPushForce;
 }
コード例 #41
0
ファイル: plSerenSword.cs プロジェクト: cWalters2/ShSoul
 void Load(string file, SPoint p)
 {
     hitbox = new HitBox();
     hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices
     hitbox.AllocateSecondIndices(0, 4);
     hitbox.SetVertex(-stats.size.x/2, 0, 0, 3);
     hitbox.SetVertex(stats.size.x/2, 0, 0, 2);
     hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1);
     hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0);
     //fHelper.Load();
     int pNum=5;//stats.id.num;
     oRotQuat = GetRotation();
     //pPtcl.LoadSerenitySwordParticles(fHelper.spriteNode, eng,  pNum);
     //pPtcl.Emit(0, SPoint(0, 0), 0);
 }
コード例 #42
0
ファイル: BattleGUI.cs プロジェクト: Reshille/Gentlemanners
 protected virtual void OnHit(HitBox strokeHitBox, MoveInfo move, CharacterInfo player)
 {
     // You can use this to have your own custom events when a character gets hit
     // TODO: we should use the player number instead of the character info because both players could use the same character
 }
コード例 #43
0
ファイル: UFE.cs プロジェクト: Reshille/Gentlemanners
 public static void FireHit(HitBox strokeHitBox, MoveInfo move, CharacterInfo player)
 {
     if (UFE.OnHit != null) UFE.OnHit(strokeHitBox, move, player);
 }
コード例 #44
0
ファイル: Ninja.cs プロジェクト: cWalters2/NeonNinja
    public virtual void LoadPlayer()
    {
        attackBox = new AttkBox(MOVENUM);
        hitbox = new HitBox();

        stats.LoadStats(STATS_FILE);
        attackBox.LoadFromScript(SCRIPT_FILE, 1, stats.size.y);
        LoadMoveScript(MOVESCRIPT);

        stats.id.num = plNum;//todo not hard code

        attackBox.grabRange = stats.grabRange;
        hitbox = new HitBox();
        fHelper = new NinjaHelper ();
        SetPlayer();
        transform.Rotate(0, 90.0f, 0);
        fHelper.Animate("Idle", true, 0);
        FindPNum();
        hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices
        hitbox.AllocateSecondIndices(0, 4);
        hitbox.SetVertex(-stats.size.x/2, 0, 0, 3);
        hitbox.SetVertex(stats.size.x/2, 0, 0, 2);
        hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1);
        hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0);

        //pPtcl.LoadParticles(eng, stats.id.num, "Yara");

        //LoadMoveScript(MOVESCRIPT);
    }
コード例 #45
0
        public void RunEvent(int eventIndex)
        {
            //Get the current event and its id
            Event e = this[eventIndex];
            if (e == null)
                return;

            uint eventId = e.EventID;
            byte eNameSpace = e.NameSpace;
            byte eID = e.ID;
            byte eCount = (byte)e.Count;
            byte eUnk = e.Unknown;

            //Get raw parameter list
            int[] p = e.Select(x => x.Data).ToArray();

            //Run event only if allowed or if an exception
            if (!_runEvents && !_runExceptions.Contains((eNameSpace << 8) | eID))
                return;

            //Variables that are used often
            int id;
            Script script;
            Event ev;
            int index;
            ArticleInfo articleInfo;
            HitBox hitbox;
            RequirementInfo reqInfo;
            ActionChangeInfo aChangeInfo;
            SubActionChangeInfo sChangeInfo;

            //Code what to do for each event here!
            switch (eventId)
            {
                case 0x01000000: //Loop Rest 1 for Goto
                    Application.DoEvents();
                    break;
                case 0x00010100: //Synchronous Timer
                    _waitFrames = (int)(e[0].RealValue + 0.5f);
                    break;
                case 0x00020000: //No Operation
                    break;
                case 0x00020100: //Asynchronous Timer
                    _waitFrames = Math.Max((int)(e[0].RealValue + 0.5f) - _frameIndex, 0);
                    break;
                case 0x00040100: //Set loop data
                    _loopCount = p[0];
                    _loopStartIndex = e.Index + 1;
                    _runEvents = false;
                    break;
                case 0x00050000: //Start looping
                    _looping = true;
                    _loopEndIndex = e.Index;
                    _eventIndex = _loopStartIndex;
                    _runEvents = true;
                    break;
                case 0x000A0100: //If
                case 0x000A0200: //If Value
                case 0x000A0300: //If Unk
                case 0x000A0400: //If Comparison
                    if (_runEvents)
                    {
                        _currentIf = _ifIndex++;
                        _runEvents = false;
                        _ifInfo = new IfInfo();

                        index = eventIndex + 1;
                        while (true)
                        {
                            if (index < Count)
                            {
                                ev = this[index];
                                id = (int)ev.EventID;
                                if (id == 0x000B0100 ||
                                    id == 0x000B0200 ||
                                    id == 0x000B0300 ||
                                    id == 0x000B0400)
                                    index++;
                                else
                                    break;
                            }
                            else
                                break;
                        }
                        _ifInfo._reqIndices = new List<int>();
                        _ifInfo._reqIndices.Add(index);

                        _ifEndIndices.Add(0);
                        reqInfo = new RequirementInfo(p[0]);
                        for (int i = 1; i < ((eventId >> 8) & 0xFF); i++)
                            reqInfo._values.Add(e[i]);
                        _ifInfo._requirements = new List<List<RequirementInfo>>();
                        _ifInfo._requirements.Add(new List<RequirementInfo>());
                        _ifInfo._requirements[0].Add(reqInfo);
                    }
                    else
                    {
                        _ifIndex++;
                    }
                    break;
                case 0x000E0000: //Else
                    if (!_runEvents)
                    {
                        if (_ifIndex == _currentIf)
                        {
                            _ifInfo._elseIndex = eventIndex;
                        }
                    }
                    else
                    {
                        if (_ifIndex == _currentIf + 1)
                            _eventIndex = _ifInfo._endIndex;
                    }
                    break;
                case 0x000D0100: //Else If (req)
                case 0x000D0200: //Else If Value (req val)
                case 0x000D0300: //Else If Unk (req val unk)
                case 0x000D0400: //Else If Comparison (req var val var)

                    if (!_runEvents)
                    {
                        if (_ifIndex == _currentIf)
                        {
                            index = eventIndex + 1;
                            while (true)
                            {
                                if (index < Count)
                                {
                                    ev = this[index];
                                    id = (int)ev.EventID;
                                    if (id == 0x000B0100 ||
                                        id == 0x000B0200 ||
                                        id == 0x000B0300 ||
                                        id == 0x000B0400)
                                        index++;
                                    else
                                        break;
                                }
                                else
                                    break;
                            }
                            _ifInfo._reqIndices.Add(index);
                        }
                    }
                    else
                    {
                        if (_ifIndex == _currentIf + 1)
                            _eventIndex = _ifInfo._endIndex;
                    }

                    if (!_runEvents && _ifIndex == _currentIf + 1)
                    {
                        reqInfo = new RequirementInfo(p[0]);
                        for (int i = 1; i < eCount; i++)
                            reqInfo._values.Add(e[i]);
                        _ifInfo._requirements.Add(new List<RequirementInfo>());
                        _ifInfo._requirements[0].Add(reqInfo);
                    }
                    break;
                case 0x000B0100: //And If
                case 0x000B0200: //And If Value
                case 0x000B0300: //And If Unk
                case 0x000B0400: //And If Comparison
                    if (!_runEvents && _ifIndex == _currentIf + 1)
                    {
                        reqInfo = new RequirementInfo(p[0]);
                        for (int i = 1; i < eCount; i++)
                            reqInfo._values.Add(e[i]);
                        _ifInfo._requirements.Add(new List<RequirementInfo>());
                        _ifInfo._requirements[0].Add(reqInfo);
                    }
                    break;
                case 0x000F0000: //End if
                    _ifIndex--;
                    if (!_runEvents)
                    {
                        if (_ifIndex == _currentIf)
                        {
                            _ifInfo._endIndex = _ifEndIndices[_currentIf] = eventIndex + 1;
                            _eventIndex = _ifInfo.Run();
                            _runEvents = true;
                        }
                    }
                    break;
                case 0x00100200: //Switch
                    _cases = new List<Parameter>();
                    _caseIndices = new List<int>();

                    //Turn off events to examine them until end switch
                    //Then the examined data will be evaluated
                    _runEvents = false;

                    _switchStartIndex = eventIndex;
                    break;
                case 0x00110100: //Case
                    if (!_runEvents)
                    {
                        if (_cases != null && _caseIndices != null)
                        {
                            _cases.Add(e[0]);
                            _caseIndices.Add(e.Index);
                        }
                    }
                    else
                    {
                        _eventIndex = _switchEndIndex + 1;
                        _switchEndIndex = -1;
                    }
                    break;
                case 0x00120000: //Default Case
                    _defaultCaseIndex = e.Index;
                    break;
                case 0x00130000: //End Switch
                    _runEvents = true;
                    _switchEndIndex = e.Index;

                    //Apply cases
                    index = 0;
                    if (_switchStartIndex >= 0 && _switchStartIndex < Count)
                    {
                        Parameter Switch = this[_switchStartIndex][1];
                        foreach (Parameter param in _cases)
                        {
                            if (Switch.Compare(param, 2))
                            {
                                _eventIndex = _caseIndices[index] + 1;
                                break;
                            }
                            index++;
                        }
                    }

                    if (_cases != null && index == _cases.Count && _defaultCaseIndex != -1)
                        _eventIndex = _defaultCaseIndex + 1;

                    _defaultCaseIndex = -1;
                    _switchStartIndex = -1;
                    _cases = null;

                    break;
                case 0x00180000: //Break
                    _eventIndex = _switchEndIndex + 1;
                    _switchEndIndex = -1;
                    break;
                case 0x10050200: //Article Visiblity
                    id = p[0];
                    if (id < 0 || id >= RunTime._articles.Length)
                        break;
                    articleInfo = RunTime._articles[id];
                    if (articleInfo != null && articleInfo._model != null)
                        articleInfo._model._visible = p[1] != 0;
                    break;
                case 0x01010000: //Loop Rest
                    _waitFrames = 1;
                    break;
                case 0x06000D00: //Offensive Collison
                case 0x062B0D00: //Thrown Collision
                    hitbox = new HitBox(e, Article != null ? Article.Index : -1);
                    hitbox.HitboxID = (int)(p[0] & 0xFFFF);
                    hitbox.HitboxSize = p[5];
                    RunTime._hitBoxes.Add(hitbox);
                    break;
                case 0x06050100: //Body Collision
                    _hurtBoxType = p[0];
                    break;
                case 0x06080200: //Bone Collision
                    id = p[0];
                    if (Root.Model != null && Root.Model._linker.BoneCache.Length > id && id >= 0)
                    {
                        MDL0BoneNode bone = Root.Model._linker.BoneCache[id] as MDL0BoneNode;
                        switch ((int)p[1])
                        {
                            case 0:
                                bone._nodeColor = Color.Transparent;
                                bone._boneColor = Color.Transparent;
                                break;
                            case 1:
                                bone._nodeColor = bone._boneColor = Color.FromArgb(255, 255, 0);
                                break;
                            default:
                                bone._nodeColor = bone._boneColor = Color.FromArgb(0, 0, 255);
                                break;
                        }
                        _boneCollisions.Add(bone);
                    }
                    break;
                case 0x06060100: //Undo Bone Collision
                    foreach (MDL0BoneNode bone in _boneCollisions)
                        bone._nodeColor = bone._boneColor = Color.Transparent;
                    _boneCollisions = new List<MDL0BoneNode>();
                    break;
                case 0x060A0800: //Catch Collision 1
                case 0x060A0900: //Catch Collision 2
                case 0x060A0A00: //Catch Collision 3
                    hitbox = new HitBox(e, Article != null ? Article.Index : -1);
                    hitbox.HitboxID = p[0];
                    hitbox.HitboxSize = p[2];
                    RunTime._hitBoxes.Add(hitbox);
                    break;
                case 0x060D0000: //Terminate Catch Collisions
                    for (int i = 0; i < RunTime._hitBoxes.Count; i++)
                        if (RunTime._hitBoxes[i].IsCatch())
                            RunTime._hitBoxes.RemoveAt(i--);
                    break;
                case 0x00060000: //Loop break
                    _looping = false;
                    _eventIndex = _loopEndIndex + 1;
                    _loopTime = 0;
                    break;
                case 0x06150F00: //Special Offensive Collison
                    hitbox = new HitBox(e, Article != null ? Article.Index : -1);
                    hitbox.HitboxID = (int)(p[0] & 0xFFFF);
                    hitbox.HitboxSize = p[5];
                    RunTime._hitBoxes.Add(hitbox);
                    break;
                case 0x06040000: //Terminate Collisions
                    for (int i = 0; i < RunTime._hitBoxes.Count; i++)
                        if (RunTime._hitBoxes[i].IsOffensive(true))
                            RunTime._hitBoxes.RemoveAt(i--);
                    break;
                case 0x06030100: //Delete hitbox
                    for (int i = 0; i < RunTime._hitBoxes.Count; i++)
                    {
                        HitBox hbox = RunTime._hitBoxes[i];
                        if (hbox.HitboxID == p[0] && hbox.IsOffensive(true))
                        {
                            RunTime._hitBoxes.RemoveAt(i--);
                            break;
                        }
                    }
                    break;
                case 0x060C0100: //Delete Catch Collision
                    for (int i = 0; i < RunTime._hitBoxes.Count; i++)
                    {
                        HitBox hbox = RunTime._hitBoxes[i];
                        if (hbox.HitboxID == p[0] && hbox.IsCatch())
                        {
                            RunTime._hitBoxes.RemoveAt(i--);
                            break;
                        }
                    }
                    break;
                case 0x061B0500: //Move hitbox
                    foreach (HitBox hbox in RunTime._hitBoxes)
                        if (hbox.HitboxID == p[0] && hbox.IsOffensive(true))
                        {
                            hbox._parameters[1] = p[1];
                            hbox._parameters[6] = p[2];
                            hbox._parameters[7] = p[3];
                            hbox._parameters[8] = p[4];
                            break;
                        }
                    break;
                case 0x04060100: //Set animation frame
                    //if (Article == null)
                    //    RunTime.SetFrame((int)(e[0].RealValue + 0.05f));
                    //else
                    //    RunTime._articles[Article.Index].SetFrame((int)(e[0].RealValue + 0.05f));
                    break;
                case 0x00070100: //Subroutine
                    script = (e[0] as EventOffset)._script;
                    if (script != null && script != _script)
                    {
                        script.Reset();
                        RunTime._runningScripts.Add(script);
                        script.SetFrame(0);
                    }
                    break;
                case 0x00080000: //Return
                    _return = true;
                    _eventIndex = Count;
                    if (RunTime._runningScripts.Contains(_script))
                        RunTime._runningScripts.Remove(_script);
                    break;
                case 0x00090100: //Go to
                    script = (e[0] as EventOffset)._script;
                    if (script != null && script != _script)
                    {
                        RunTime._runningScripts.Remove(_script);
                        script.Reset();
                        RunTime._runningScripts.Add(script);
                        script.SetFrame(0);
                    }
                    break;
                case 0x0A030100: //Stop sound
                    id = p[0];
                    if (RunTime._playingSounds.ContainsKey(id))
                    {
                        List<AudioInfo> aList = RunTime._playingSounds[id];
                        foreach (AudioInfo aInfo in aList)
                            if (aInfo._buffer != null)
                            {
                                aInfo._buffer.Stop();
                                aInfo._buffer.Dispose();
                                aInfo._stream.Dispose();

                            }
                        RunTime._playingSounds.Remove(id);
                    }
                    break;
                case 0x0A000100: //Play sound
                case 0x0A010100:
                case 0x0A020100:
                case 0x0A040100:
                case 0x0A050100:
                case 0x0A060100:
                case 0x0A070100:
                case 0x0A080100:
                case 0x0A090100:
                case 0x0A0A0100:
                case 0x0A0B0100:
                case 0x0A0C0100:
                case 0x0A0D0100:
                case 0x0A0E0100:
                case 0x0A0F0100:

                    if (RunTime._muteSFX)
                        break;

                    id = p[0];
                    if (Manager.SoundArchive != null)
                    {
                        RSARNode node = Manager.SoundArchive;
                        List<RSAREntryNode> sounds = node._infoCache[0];
                        if (id >= 0 && id < sounds.Count)
                        {
                            RSARSoundNode s = sounds[id] as RSARSoundNode;
                            if (s != null)
                            {
                                IAudioStream stream = s.CreateStreams()[0];
                                AudioBuffer b = Manager._audioProvider.CreateBuffer(stream);
                                AudioInfo info = new AudioInfo(b, stream);

                                if (RunTime._playingSounds.ContainsKey(id))
                                    RunTime._playingSounds[id].Add(info);
                                else
                                    RunTime._playingSounds[id] = new List<AudioInfo>() { info };

                                b.Reset();
                                b.Seek(0);
                                b.Play();
                            }
                        }
                    }
                    break;
                case 0x0B000200: //Model Changer 1
                case 0x0B010200: //Model Changer 2

                    ModelVisibility visNode = null;
                    if (Article != null)
                    {
                        //Check if we have data to work with
                        articleInfo = RunTime._articles[Article.Index];

                        if (articleInfo == null ||
                            articleInfo._model == null ||
                            articleInfo._model._objList == null ||
                            articleInfo._article._mdlVis == null ||
                            articleInfo._article._mdlVis.Count == 0) break;

                        visNode = articleInfo._article._mdlVis;
                    }
                    else
                    {
                        //Check if we have data to work with
                        if (Root.Model._objList == null ||
                            Root.Data._modelVis.Count == 0) break;

                        visNode = Root.Data._modelVis;
                    }

                    //Get the target reference
                    ModelVisReference refEntry = Root.Data._modelVis[((int)(eventId >> 16 & 1))];

                    //Check if the reference and switch id is usable
                    if (refEntry.Count == 0 || p[0] < 0 || p[0] >= refEntry.Count) break;

                    //Turn off objects
                    ModelVisBoneSwitch SwitchNode = refEntry[p[0]];
                    foreach (ModelVisGroup grp in SwitchNode)
                        foreach (BoneIndexValue b in grp._bones)
                            if (b.BoneNode != null)
                                foreach (MDL0ObjectNode obj in b.BoneNode._manPolys)
                                    obj._render = false;

                    //Check if the group id is usable
                    if (p[1] > SwitchNode.Count || p[1] < 0) break;

                    //Turn on objects
                    ModelVisGroup group = SwitchNode[p[1]];
                    if (group != null)
                        foreach (BoneIndexValue b in group._bones)
                            if (b.BoneNode != null)
                                foreach (MDL0ObjectNode obj in b.BoneNode._manPolys)
                                    obj._render = true;

                    break;
                case 0x0B020100: //Model visibility
                    if (Article == null)
                        Root.Model._visible = p[0] != 0;
                    else if (Article.Index < RunTime._articles.Length && RunTime._articles[Article.Index]._model != null)
                        RunTime._articles[Article.Index]._model._visible = p[0] != 0;
                    break;
                case 0x0D000200: //Concurrent Infinite Loop
                    index = p[0];
                    EventOffset off = (e[1] as EventOffset);
                    if (off._script != null)
                    {
                        if (RunTime._concurrentLoopScripts.ContainsKey(index))
                            RunTime._concurrentLoopScripts.Remove(index);
                        RunTime._concurrentLoopScripts.Add(index, off._script);
                    }
                    break;
                case 0x0D010100: //Terminate Concurrent Infinite Loop
                    index = p[0];
                    if (RunTime._concurrentLoopScripts.ContainsKey(index))
                        RunTime._concurrentLoopScripts.Remove(index);
                    break;
                case 0x0E000100: //Set Air/Ground
                    RunTime._location = (RunTime.Location)(p[0]);
                    break;
                case 0x10000100: //Generate Article
                case 0x10000200: //Generate Article
                case 0x10030100: //Remove Article

                    //These events do a similar job!
                    bool removeArticle = eID == 3;

                    //Make sure we have all the data we need available
                    MainControl main = MainForm.Instance._mainControl;
                    MovesetFile mNode = Manager.Moveset;
                    if (mNode == null)
                        break;
                    DataSection d = mNode.Data;
                    if (d == null)
                        break;

                    //Get the id of the article to be called and check it
                    int aId2 = p[0];
                    if (aId2 < 0 || aId2 >= RunTime._articles.Length)
                        break;

                    //Get the called article from the article list
                    articleInfo = RunTime._articles[aId2];

                    if (articleInfo == null)
                        return;

                    //Remove or add the article
                    if (removeArticle)
                    {
                        if (!articleInfo.Running)
                            return;

                        //Remove the article's model from the scene
                        if (articleInfo._model != null)
                        {
                            main.RemoveTarget(articleInfo._model);
                            articleInfo._model._visible = false;
                        }

                        //This article is no longer available for use
                        articleInfo.Running = false;
                    }
                    else
                    {
                        if (articleInfo.Running)
                            return;

                        //Add the article's model to the scene
                        if (articleInfo._model != null)
                        {
                            main.AddTarget(articleInfo._model);
                            articleInfo._model._visible = true;
                        }

                        //This article is now available for use
                        articleInfo.Running = true;
                    }
                    break;
                case 0x10040200: //Set Anchored Article SubAction
                case 0x10070200: //Set Remote Article SubAction
                    id = p[0];
                    int sId = p[1];
                    if (id < 0 || id >= RunTime._articles.Length)
                        break;

                    //Get the called article from the article list
                    articleInfo = RunTime._articles[id];
                    if (articleInfo != null)
                    {
                        articleInfo.SubactionIndex = sId;
                        articleInfo._setAt = _frameIndex;
                    }
                    break;
                case 0x10010200: //Set Ex-Anchored Article Action
                    break;
                case 0x12000200: //Basic Var Set
                case 0x12060200: //Float Var Set
                    e[1].RealValue = e[0].RealValue;
                    break;
                case 0x12010200: //Basic Var Add
                case 0x12070200: //Float Var Add
                    e[1].RealValue = e[1].RealValue + e[0].RealValue;
                    break;
                case 0x12020200: //Basic Var Sub
                case 0x12080200: //Float Var Sub
                    e[1].RealValue = e[1].RealValue - e[0].RealValue;
                    break;
                case 0x12030100: //Basic Var Inc
                    e[0].RealValue = e[0].RealValue + 1.0f;
                    break;
                case 0x12040100: //Basic Var Dec
                    e[0].RealValue = e[0].RealValue - 1.0f;
                    break;
                case 0x120A0100: //Bit Variable Set
                    e[0].RealValue = 1.0f;
                    break;
                case 0x120B0100: //Bit Variable Clear
                    e[0].RealValue = 0.0f;
                    break;
                case 0x120F0200: //Float Variable Multiply
                    e[1].RealValue = e[1].RealValue * e[0].RealValue;
                    break;
                case 0x12100200: //Float Variable Divide
                    if (e[0].RealValue != 0)
                        e[1].RealValue = e[1].RealValue / e[0].RealValue;
                    break;
                case 0x64000000: //Allow Interrupt
                    RunTime._allowInterrupt = true;
                    break;
                case 0x02000300: //Change Action Status
                case 0x02000400:
                case 0x02000500:
                case 0x02000600:

                    break;
                case 0x02010200: //Change Action
                case 0x02010300:
                case 0x02010400:
                case 0x02010500:
                    aChangeInfo = new ActionChangeInfo(p[0]);
                    reqInfo = new RequirementInfo(p[1]);
                    for (int i = 2; i < Count; i++)
                        reqInfo._values.Add(e[i]);
                    aChangeInfo._requirements.Add(reqInfo);
                    RunTime.AddActionChangeInfo(aChangeInfo);
                    break;
                case 0x02040100: //Additional Change Action Requirement
                case 0x02040200:
                case 0x02040300:
                case 0x02040400:

                    break;
                case 0x02060100: //Enable Action Status ID
                    break;
                case 0x02080100: //Disable Action Status ID
                    break;
                case 0x02090200: //Invert Action Status ID
                    break;
                case 0x020A0100: //Allow Specific Interrupt
                    break;
                case 0x020B0100: //Disallow Specific Interrupt
                    break;
                case 0x020C0100: //Unregister Interrupt
                    break;
                case 0x04000100: //Change Subaction
                case 0x04000200:
                    sChangeInfo = new SubActionChangeInfo(p[0], eCount == 2 && p[1] != 0);
                    RunTime.AddSubActionChangeInfo(sChangeInfo);
                    break;
                case 0x04010200: //Change Subaction
                    sChangeInfo = new SubActionChangeInfo(p[0], false);
                    sChangeInfo._requirements.Add(new RequirementInfo(p[1]));
                    RunTime.AddSubActionChangeInfo(sChangeInfo);
                    break;
            }
        }
コード例 #46
0
ファイル: plSerenity.cs プロジェクト: cWalters2/ShSoul
    /*void LoadMoveScript(string s){

        int endL, enPos;
        float dVal;
    std:string par, val, line;
        ifstream infile;//get the polygon count for the arrays
        infile.open(s);
        if (infile.is_open()){
            while ( infile.good() ){
                getline (infile,line);
                endL = line.length()-1;
                enPos = line.find_first_of("=");
                par = line.substr(0, enPos);
                val = line.substr(enPos+1, line.length());
                dVal = atof(val.c_str());
                if(par.compare("scSpeed") == 0)
                    scSpd=dVal;
            }
        }

    }*/
    bool LoadPlayer()
    {
        FindPNum ();

        attackBox = new AttkBox ();
        hitbox = new HitBox();

        hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices
        hitbox.AllocateSecondIndices(0, 4);
        hitbox.SetVertex(-stats.size.x/2, 0, 0, 3);
        hitbox.SetVertex(stats.size.x/2, 0, 0, 2);
        hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1);
        hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0);
        fHelper.grabBox = new HitBox();
        fHelper.grabBox.AllocateFirstIndices(1);
        fHelper.grabBox.AllocateSecondIndices(0, 4);
        fHelper.grabBox.SetVertex(-stats.size.x/2, stats.size.y + stats.edgegrab.hgt, 0, 0);
        fHelper.grabBox.SetVertex(-stats.size.x/2, stats.size.y, 0, 3);
        fHelper.grabBox.SetVertex(-stats.size.x/2 - stats.edgegrab.wid, stats.size.y, 0, 2);
        fHelper.grabBox.SetVertex(-stats.size.x/2 - stats.edgegrab.wid, stats.size.y + stats.edgegrab.hgt, 0, 16);
        fHelper.grabBox.isActive = false;
        fHelper.sScale=1;
        //fHelper.Load(eng, MESH_FILE, GetPos());
        stats.LoadStats(STATS_FILE);

        attackBox.LoadFromScript(SCRIPT_FILE, fHelper.sScale, stats.size.y);

        stats.id.num = plNum;//todo not hard code
        SetPlayer ();
        transform.Rotate (0, 90.0f, 0);
        fHelper.Animate ("Idle", true, 0);
        LoadMoveScript (MOVE_FILE);

        //

        //psysword.Load( PSYSWORD_MESH_FILE, GetPos());//load sword model
        //psysword.LoadAnimHolder( PSYSWORD_ANIMHELP, GetPos());//load serenity's anims for reference
        psysword.attackBox.LoadFromScript(SCRIPT_FILE, fHelper.sScale, stats.size.y);
        SPoint bT = new SPoint(0, -psysword.stats.size.y);

        psysword.attackBox.TranslateAttack(bT, NB);
        psysword.attackBox.TranslateAttack(bT, SB);
        psysword.attackBox.TranslateAttack(bT, UB);
        psysword.attackBox.TranslateAttack(bT, DB);

        //LoadMoveScript(MOVESCRIPT);
        return true;
    }
コード例 #47
0
ファイル: Fighter.cs プロジェクト: cWalters2/ShSoul
    public virtual void LoadPlayer()
    {
        FindPNum ();
        attackBox = new AttkBox ();
        attackBox.grabRange = stats.grabRange;
        hitbox = new HitBox();
        fHelper = new FighterHelper ();
        hitbox.AllocateFirstIndices(1);//for a 1 dimensional array of vertices
        hitbox.AllocateSecondIndices(0, 4);
        hitbox.SetVertex(-stats.size.x/2, 0, 0, 3);
        hitbox.SetVertex(stats.size.x/2, 0, 0, 2);
        hitbox.SetVertex(stats.size.x/2, stats.size.y, 0, 1);
        hitbox.SetVertex(-stats.size.x/2, stats.size.y, 0, 0);
        fHelper.grabBox = new HitBox ();
        fHelper.grabBox.AllocateFirstIndices (1);
        fHelper.grabBox.AllocateSecondIndices (0, 4);
        fHelper.grabBox.SetVertex (-stats.size.x / 2, stats.size.y + stats.edgegrab.hgt, 0, 0);
        fHelper.grabBox.SetVertex (-stats.size.x / 2, stats.size.y, 0, 3);
        fHelper.grabBox.SetVertex (-stats.size.x / 2 - stats.edgegrab.wid, stats.size.y, 0, 2);
        fHelper.grabBox.SetVertex (-stats.size.x / 2 - stats.edgegrab.wid, stats.size.y + stats.edgegrab.hgt, 0, 16);
        fHelper.grabBox.isActive = false;
        fHelper.sScale=1;

        //pPtcl.LoadParticles(eng, stats.id.num, "Yara");

        //LoadMoveScript(MOVESCRIPT);
    }
コード例 #48
0
ファイル: Fighter.cs プロジェクト: cWalters2/ShSoul
 public bool CreateColBox()
 {
     if (debugHitbox == null) {
         debugHitbox = new GameObject ();
         debugHitbox.name = "hb"+stats.id.num;
         debugHitbox.AddComponent<MeshFilter>();
         debugHitbox.AddComponent<MeshRenderer>();
         debugHitbox.GetComponent<MeshRenderer>().material = hitboxMat;
         HitBox cfHB = new HitBox();
         cfHB.AllocateFirstIndices(1);
         cfHB.AllocateSecondIndices(0,4);
         SPoint[]  cmbHB=GetHitBox();
         for(int i=0;i<4;i++){
             cfHB.SetVertex(cmbHB[i].x-GetPos().x*2, cmbHB[i].y-GetPos().y*2, 0, i);
         }
         cfHB.Render("HitBox", GetPos(), stats.id.num);
         MeshFilter mf = debugHitbox.GetComponent<MeshFilter>();
         mf.mesh = cfHB.mesh;
         DontDestroyOnLoad(debugHitbox);
         debugHitbox.transform.position = new Vector3(stats.motion.pos.x, stats.motion.pos.y, 0);
         return true;
     } else
         return false;
 }
コード例 #49
0
ファイル: BasicPunch.cs プロジェクト: kfoznot/Avatar
 protected override void Start()
 {
     hitbox = GetComponent<HitBox>();
     sprite = GetComponent<SpriteRenderer>();
 }
コード例 #50
0
ファイル: plSerenSword.cs プロジェクト: cWalters2/ShSoul
 void LoadPlayer()
 {
     attackBox = new AttkBox ();
     hitbox = new HitBox();
     fHelper = new FighterHelper ();
     LoadMoveScript (MOVE_FILE);
 }
コード例 #51
0
 private void invertTransform(HitBox hb1, HitBox hb2)
 {
     Transform transformStorage = hb2.position;
     hb2.position = hb1.position;
     hb1.position = transformStorage;
 }
コード例 #52
0
ファイル: GUIScript.cs プロジェクト: Reshille/Gentlemanners
 void OnHit(HitBox strokeHitBox, MoveInfo move, CharacterInfo hitter)
 {
     // You can use this to have your own custom events when a character gets hit
 }
コード例 #53
0
ファイル: ShootScript.cs プロジェクト: napTu3aH/Racing
    /*void Update()
    {
        Shoot();
    }*/
    /// <summary>
    /// Метод, описывающий логику выстрела.
    /// </summary>
    void Shooting(float _damage, float _timeBetweenShot)
    {
        if (_Time < _timeBetweenShot)
        {
            _Time += Time.deltaTime;
            if (_Time >= _timeBetweenShot)
            {
                Ray _ray = new Ray(_Barrel.position, _Barrel.forward);
                RaycastHit _hit;

                if (Physics.Raycast(_ray, out _hit, _DistanceForShooting))
                {
                    if (!_TargetedHitBox || _hit.collider.name != _TargetedHitBox.name)
                    {
                        _TargetedHitBox = _hit.collider.GetComponent<HitBox>();
                    } else
                    {
                        _TargetedHitBox.Hitted(_damage);
                    }
                    Debugger.Instance.Line(_ray.origin, _hit.point);
                }
                _Time = 0.0f;
            }
        }
    }
コード例 #54
0
    public static Vector3 TestCollision(HitBox[] hitBoxes, HurtBox[] hurtBoxes, HitConfirmType hitConfirmType, int mirror)
    {
        foreach (HitBox hitBox in hitBoxes) {
            if (hitBox.hide) continue;
            if (hitBox.collisionType == CollisionType.noCollider) continue;
            if (hitConfirmType == HitConfirmType.Throw && hitBox.collisionType != CollisionType.throwCollider) continue;
            if (hitConfirmType == HitConfirmType.Hit && hitBox.collisionType == CollisionType.throwCollider) continue;

            hitBox.state = 0;
            foreach (HurtBox hurtBox in hurtBoxes) {
                Vector3 hurtBoxPosition = hurtBox.position;
                Vector3 hitBoxPosition = hitBox.position.position;
                float dist = 0;
                bool collisionConfirm = false;

                if (!UFE.config.detect3D_Hits){
                    hurtBoxPosition.z = -1;
                    hitBoxPosition.z = -1;
                }

                if (hurtBox.shape == HitBoxShape.circle){
                    if (hitBox.shape == HitBoxShape.circle){
                        dist = Vector3.Distance(hurtBoxPosition, hitBoxPosition);
                        if (dist <= hurtBox.radius + hitBox.radius) collisionConfirm = true;

                    }else if (hitBox.shape == HitBoxShape.rectangle){
                        float mirrorDiff = mirror > 0 ? hitBox.rect.width : 0f;
                        Rect hitBoxRectanglePosition = new Rect(((hitBox.rect.x + mirrorDiff) * mirror) + hitBoxPosition.x,
                                                                hitBox.rect.y + hitBoxPosition.y,
                                                                hitBox.rect.width, hitBox.rect.height);
                        if (hitBox.followXBounds){
                            hitBoxRectanglePosition.x = hitBox.rendererBounds.x - (hitBox.rect.width/2);
                            hitBoxRectanglePosition.width = (hitBox.rendererBounds.width + hitBox.rect.width) - hitBox.rendererBounds.x;
                        }
                        if (hitBox.followYBounds){
                            hitBoxRectanglePosition.y = hitBox.rendererBounds.y - (hitBox.rect.height/2);
                            hitBoxRectanglePosition.height = (hitBox.rendererBounds.height + hitBox.rect.height) - hitBox.rendererBounds.y;
                        }

                        dist = distancePointToRectangle(hurtBoxPosition, hitBoxRectanglePosition);
                        if (dist <= hurtBox.radius) collisionConfirm = true;
                    }
                }else if (hurtBox.shape == HitBoxShape.rectangle){
                    Rect hurtBoxRectanglePosition;
                    if (hitBox.shape == HitBoxShape.circle){
                        float mirrorDiff = mirror < 0 ? hurtBox.rect.width : 0f;
                        hurtBoxRectanglePosition = new Rect(((hurtBox.rect.x + mirrorDiff) * mirror) + hurtBoxPosition.x,
                                                            hurtBox.rect.y + hurtBoxPosition.y,
                                                            hurtBox.rect.width, hurtBox.rect.height);
                        if (hurtBox.followXBounds){
                            hurtBoxRectanglePosition.x = hurtBox.rendererBounds.x - (hurtBox.rect.width/2);
                            hurtBoxRectanglePosition.width = (hurtBox.rendererBounds.width + hurtBox.rect.width) - hurtBox.rendererBounds.x;
                        }
                        if (hurtBox.followYBounds){
                            hurtBoxRectanglePosition.y = hurtBox.rendererBounds.y - (hurtBox.rect.height/2);
                            hurtBoxRectanglePosition.height = (hurtBox.rendererBounds.height + hurtBox.rect.height) - hurtBox.rendererBounds.y;
                        }

                        dist = distancePointToRectangle(hitBoxPosition, hurtBoxRectanglePosition);
                        if (dist <= hitBox.radius) collisionConfirm = true;

                    }else if (hitBox.shape == HitBoxShape.rectangle){
                        float mirrorDiff = mirror < 0 ? hurtBox.rect.width : 0f;
                        hurtBoxRectanglePosition = new Rect(((hurtBox.rect.x + mirrorDiff) * mirror) + hurtBoxPosition.x,
                                                            hurtBox.rect.y + hurtBoxPosition.y,
                                                            hurtBox.rect.width, hurtBox.rect.height);

                        mirrorDiff = mirror > 0 ? hitBox.rect.width : 0f;
                        Rect hitBoxRectanglePosition = new Rect(((hitBox.rect.x + mirrorDiff) * - mirror) + hitBoxPosition.x,
                                                           hitBox.rect.y + hitBoxPosition.y,
                                                           hitBox.rect.width, hitBox.rect.height);
                        if (hitBox.followXBounds){
                            hitBoxRectanglePosition.x = hitBox.rendererBounds.x - (hitBox.rect.width/2);
                            hitBoxRectanglePosition.width = (hitBox.rendererBounds.width + hitBox.rect.width) - hitBox.rendererBounds.x;
                        }
                        if (hitBox.followYBounds){
                            hitBoxRectanglePosition.y = hitBox.rendererBounds.y - (hitBox.rect.height/2);
                            hitBoxRectanglePosition.height = (hitBox.rendererBounds.height + hitBox.rect.height) - hitBox.rendererBounds.y;
                        }

                        if (hurtBox.followXBounds){
                            hurtBoxRectanglePosition.x = hurtBox.rendererBounds.x - (hurtBox.rect.width/2);
                            hurtBoxRectanglePosition.width = (hurtBox.rendererBounds.width + hurtBox.rect.width) - hurtBox.rendererBounds.x;
                        }
                        if (hurtBox.followYBounds){
                            hurtBoxRectanglePosition.y = hurtBox.rendererBounds.y - (hurtBox.rect.height/2);
                            hurtBoxRectanglePosition.height = (hurtBox.rendererBounds.height + hurtBox.rect.height) - hurtBox.rendererBounds.y;
                        }

                        if (hurtBoxRectanglePosition.Overlaps(hitBoxRectanglePosition)) collisionConfirm = true;
                    }
                }

                if (collisionConfirm) {
                    if (hitConfirmType == HitConfirmType.Hit) {
                        hitBox.state = 1;
                    }
                    return (hurtBoxPosition + hitBoxPosition)/2;
                }
            }
        }

        foreach (HitBox hitBox in hitBoxes) {
            if (hitBox.state == 1) hitBox.state = 0;
        }
        return Vector3.zero;
    }
コード例 #55
0
ファイル: WeaponRotate.cs プロジェクト: napTu3aH/Racing
 void OnTriggerStay(Collider _col)
 {
     if (!_Targeted)
     {
         if (_col.CompareTag("HitBox") && _col.GetComponent<HitBox>()._HitBoxHealth > 0.0f)
         {
             _Target = _col.transform;
             _TargetedHitBox = _col.GetComponent<HitBox>();
             _Targeted = true;
         }
     }
 }
コード例 #56
0
 public void HideHitBoxes(HitBox[] invincibleHitBoxes, bool hide)
 {
     foreach (HitBox hitBox in invincibleHitBoxes) {
         hitBox.hide = hide;
     }
 }
コード例 #57
0
ファイル: Mdl.cs プロジェクト: Frassle/Ibasa
        ImmutableArray<HitBox> LoadHitBoxes(Ibasa.IO.BinaryReader reader, int count)
        {
            long offset = reader.BaseStream.Position;

            HitBox[] hitBoxes = new HitBox[count];
            for (int i = 0; i < count; ++i)
            {
                reader.BaseStream.Position = offset;

                int bone = reader.ReadInt32();
                int group = reader.ReadInt32();
                Boxf box = new Boxf(
                    new Point3f(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()),
                    new Size3f(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()));
                long nameOffset = offset + reader.ReadInt32();

                reader.Seek(8*4, SeekOrigin.Current); //skip 8 ints

                offset = reader.BaseStream.Position;

                reader.BaseStream.Position = nameOffset;
                string name = LoadString(reader);

                hitBoxes[i] = new HitBox(bone, group, box, name);
            }
            return new ImmutableArray<HitBox>(hitBoxes);
        }